summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-07-06 12:17:22 -0400
committerSimo Sorce <idra@samba.org>2008-07-06 12:17:22 -0400
commit632e42e16503ba6e34e8bcb3a9449a2c39805426 (patch)
tree6434aecd15544b6c414eb2c8afef52b8fcd5dcf3
parentd0a71a00bb0408713eca523807955b6dd087f2bc (diff)
downloadsamba-632e42e16503ba6e34e8bcb3a9449a2c39805426.tar.gz
samba-632e42e16503ba6e34e8bcb3a9449a2c39805426.tar.bz2
samba-632e42e16503ba6e34e8bcb3a9449a2c39805426.zip
More clean up, indentation and trailing space removal
(This used to be commit d17d401603c1c26a5fd5eca5ece245790445e6d4)
-rw-r--r--source3/winbindd/winbindd_user.c79
1 files changed, 39 insertions, 40 deletions
diff --git a/source3/winbindd/winbindd_user.c b/source3/winbindd/winbindd_user.c
index 270a297b7c..c75ed4adf1 100644
--- a/source3/winbindd/winbindd_user.c
+++ b/source3/winbindd/winbindd_user.c
@@ -564,7 +564,7 @@ void winbindd_endpwent(struct winbindd_cli_state *state)
{
DEBUG(3, ("[%5lu]: endpwent\n", (unsigned long)state->pid));
- free_getent_state(state->getpwent_state);
+ free_getent_state(state->getpwent_state);
state->getpwent_initialized = False;
state->getpwent_state = NULL;
request_ok(state);
@@ -600,23 +600,23 @@ static bool get_sam_user_entries(struct getent_state *ent, TALLOC_CTX *mem_ctx)
SAFE_FREE(ent->sam_entries);
ent->num_sam_entries = 0;
-
+
/* Call query_user_list to get a list of usernames and user rids */
num_entries = 0;
- status = methods->query_user_list(domain, mem_ctx, &num_entries,
- &info);
-
+ status = methods->query_user_list(domain, mem_ctx, &num_entries, &info);
+
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(10,("get_sam_user_entries: query_user_list failed with %s\n",
- nt_errstr(status) ));
+ DEBUG(10,("get_sam_user_entries: "
+ "query_user_list failed with %s\n",
+ nt_errstr(status)));
return False;
}
if (num_entries) {
- name_list = SMB_REALLOC_ARRAY(name_list, struct getpwent_user, ent->num_sam_entries + num_entries);
-
+ name_list = SMB_REALLOC_ARRAY(name_list, struct getpwent_user,
+ ent->num_sam_entries + num_entries);
if (!name_list) {
DEBUG(0,("get_sam_user_entries realloc failed.\n"));
return False;
@@ -628,40 +628,40 @@ static bool get_sam_user_entries(struct getent_state *ent, TALLOC_CTX *mem_ctx)
if (!info[i].acct_name) {
fstrcpy(name_list[ent->num_sam_entries + i].name, "");
} else {
- fstrcpy(name_list[ent->num_sam_entries + i].name,
- info[i].acct_name);
+ fstrcpy(name_list[ent->num_sam_entries + i].name,
+ info[i].acct_name);
}
if (!info[i].full_name) {
fstrcpy(name_list[ent->num_sam_entries + i].gecos, "");
} else {
- fstrcpy(name_list[ent->num_sam_entries + i].gecos,
- info[i].full_name);
+ fstrcpy(name_list[ent->num_sam_entries + i].gecos,
+ info[i].full_name);
}
if (!info[i].homedir) {
- fstrcpy(name_list[ent->num_sam_entries + i].homedir, "");
+ fstrcpy(name_list[ent->num_sam_entries + i].homedir,"");
} else {
- fstrcpy(name_list[ent->num_sam_entries + i].homedir,
- info[i].homedir);
+ fstrcpy(name_list[ent->num_sam_entries + i].homedir,
+ info[i].homedir);
}
if (!info[i].shell) {
fstrcpy(name_list[ent->num_sam_entries + i].shell, "");
} else {
- fstrcpy(name_list[ent->num_sam_entries + i].shell,
- info[i].shell);
+ fstrcpy(name_list[ent->num_sam_entries + i].shell,
+ info[i].shell);
}
-
-
+
+
/* User and group ids */
sid_copy(&name_list[ent->num_sam_entries+i].user_sid,
&info[i].user_sid);
sid_copy(&name_list[ent->num_sam_entries+i].group_sid,
&info[i].group_sid);
}
-
+
ent->num_sam_entries += num_entries;
-
+
/* Fill in remaining fields */
-
+
ent->sam_entries = name_list;
ent->sam_entry_index = 0;
return ent->num_sam_entries > 0;
@@ -694,20 +694,20 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
request_error(state);
return;
}
-
- if ((state->response.extra_data.data = SMB_MALLOC_ARRAY(struct winbindd_pw, num_users)) == NULL) {
+
+ user_list = SMB_MALLOC_ARRAY(struct winbindd_pw, num_users);
+ if (!user_list) {
request_error(state);
return;
}
+ /* will be freed by process_request() */
+ state->response.extra_data.data = user_list;
- memset(state->response.extra_data.data, 0, num_users *
- sizeof(struct winbindd_pw));
-
- user_list = (struct winbindd_pw *)state->response.extra_data.data;
+ memset(user_list, 0, num_users * sizeof(struct winbindd_pw));
if (!state->getpwent_initialized)
winbindd_setpwent_internal(state);
-
+
if (!(ent = state->getpwent_state)) {
request_error(state);
return;
@@ -737,19 +737,19 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
SAFE_FREE(ent);
ent = next_ent;
}
-
+
/* No more domains */
- if (!ent)
+ if (!ent)
break;
}
name_list = (struct getpwent_user *)ent->sam_entries;
/* Lookup user info */
-
+
result = winbindd_fill_pwent(
- ent->domain_name,
+ ent->domain_name,
name_list[ent->sam_entry_index].name,
&name_list[ent->sam_entry_index].user_sid,
&name_list[ent->sam_entry_index].group_sid,
@@ -757,22 +757,21 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
name_list[ent->sam_entry_index].homedir,
name_list[ent->sam_entry_index].shell,
&user_list[user_list_ndx]);
-
+
/* Add user to return list */
-
+
if (result) {
-
+
user_list_ndx++;
state->response.data.num_entries++;
- state->response.length +=
- sizeof(struct winbindd_pw);
+ state->response.length += sizeof(struct winbindd_pw);
} else
DEBUG(1, ("could not lookup domain user %s\n",
name_list[ent->sam_entry_index].name));
ent->sam_entry_index++;
-
+
}
/* Out of domains */