summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/group.c8
-rw-r--r--server/netgroup.c80
2 files changed, 44 insertions, 44 deletions
diff --git a/server/group.c b/server/group.c
index 7b0c9a3..fe5d488 100644
--- a/server/group.c
+++ b/server/group.c
@@ -770,7 +770,7 @@ static enum nss_status ng_chase(const char *dn, ldap_initgroups_args_t * lia)
{
struct ldap_args a;
enum nss_status stat;
- struct ent_context *ctx = NULL;
+ struct ent_context *ctx=NULL;
const char *gidnumber_attrs[2];
int erange;
@@ -812,7 +812,7 @@ static enum nss_status ng_chase_backlink(const char ** membersOf, ldap_initgroup
{
struct ldap_args a;
enum nss_status stat;
- struct ent_context *ctx = NULL;
+ struct ent_context *ctx=NULL;
const char *gidnumber_attrs[3];
const char **memberP;
const char **filteredMembersOf; /* remove already traversed groups */
@@ -906,7 +906,7 @@ static enum nss_status group_bymember(const char *user, long int *start,
const char *filter;
struct ldap_args a;
enum nss_status stat;
- struct ent_context *ctx = NULL;
+ struct ent_context *ctx=NULL;
const char *gidnumber_attrs[3];
enum ldap_map_selector map = LM_GROUP;
@@ -988,7 +988,7 @@ static enum nss_status group_bymember(const char *user, long int *start,
gidnumber_attrs[1] = NULL;
}
- if (_nss_ldap_ent_context_init_locked (&ctx) == NULL)
+ if (_nss_ldap_ent_context_init_locked(&ctx)==NULL)
{
debug ("<== group_bymember (ent_context_init failed)");
_nss_ldap_leave ();
diff --git a/server/netgroup.c b/server/netgroup.c
index 5d5e5a1..ada452a 100644
--- a/server/netgroup.c
+++ b/server/netgroup.c
@@ -50,33 +50,6 @@
static struct ent_context *_ngbe = NULL;
-/*
- * I (Luke Howard) pulled the following macro (EXPAND), functions
- * (strip_whitespace and _nss_netgroup_parseline) and structures
- * (name_list and __netgrent) from glibc-2.2.x. _nss_netgroup_parseline
- * became _nss_ldap_parse_netgr after some modification.
- *
- * The rest of the code is modeled on various other _nss_ldap functions.
- */
-
-#define EXPAND(needed) \
- do \
- { \
- size_t old_cursor = result->cursor - result->data; \
- \
- result->data_size += 512 > 2 * needed ? 512 : 2 * needed; \
- result->data = realloc (result->data, result->data_size); \
- \
- if (result->data == NULL) \
- { \
- stat = NSS_STATUS_UNAVAIL; \
- goto out; \
- } \
- \
- result->cursor = result->data + old_cursor; \
- } \
- while (0)
-
/* A netgroup can consist of names of other netgroups. We have to
track which netgroups were read and which still have to be read. */
@@ -112,6 +85,33 @@ struct __netgrent
struct name_list *needed_groups;
};
+/*
+ * I (Luke Howard) pulled the following macro (EXPAND), functions
+ * (strip_whitespace and _nss_netgroup_parseline) and structures
+ * (name_list and __netgrent) from glibc-2.2.x. _nss_netgroup_parseline
+ * became _nss_ldap_parse_netgr after some modification.
+ *
+ * The rest of the code is modeled on various other _nss_ldap functions.
+ */
+
+#define EXPAND(needed) \
+ do \
+ { \
+ size_t old_cursor = result->cursor - result->data; \
+ \
+ result->data_size += 512 > 2 * needed ? 512 : 2 * needed; \
+ result->data = realloc (result->data, result->data_size); \
+ \
+ if (result->data == NULL) \
+ { \
+ stat = NSS_STATUS_UNAVAIL; \
+ goto out; \
+ } \
+ \
+ result->cursor = result->data + old_cursor; \
+ } \
+ while (0)
+
static char *
strip_whitespace (char *str)
{
@@ -283,19 +283,6 @@ out:
return stat;
}
-enum nss_status _nss_ldap_endnetgrent(struct __netgrent *result)
-{
- if (result->data != NULL)
- {
- free (result->data);
- result->data = NULL;
- result->data_size = 0;
- result->cursor = NULL;
- }
-
- LOOKUP_ENDENT (_ngbe);
-}
-
enum nss_status _nss_ldap_setnetgrent(char *group,struct __netgrent *result)
{
int errnop = 0, buflen = 0;
@@ -328,3 +315,16 @@ enum nss_status _nss_ldap_getnetgrent_r(struct __netgrent *result,
{
return _nss_ldap_parse_netgr (result, buffer, buflen);
}
+
+enum nss_status _nss_ldap_endnetgrent(struct __netgrent *result)
+{
+ if (result->data != NULL)
+ {
+ free (result->data);
+ result->data = NULL;
+ result->data_size = 0;
+ result->cursor = NULL;
+ }
+
+ LOOKUP_ENDENT (_ngbe);
+}