summaryrefslogtreecommitdiff
path: root/source3/smbd/password.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-10-16 20:13:26 +0000
committerLuke Leighton <lkcl@samba.org>1998-10-16 20:13:26 +0000
commit5cb99177aff3522427d520d5f5159989f6d72265 (patch)
treee656c3ca8da153725df124aa9f3e687a48eac017 /source3/smbd/password.c
parent27a819cb54b5c7e9113e914f100c07d9836db7b9 (diff)
downloadsamba-5cb99177aff3522427d520d5f5159989f6d72265.tar.gz
samba-5cb99177aff3522427d520d5f5159989f6d72265.tar.bz2
samba-5cb99177aff3522427d520d5f5159989f6d72265.zip
setup_groups() - code clarification. no functional change.
(This used to be commit dae7c5ea9a139552e1722357172fa1ad0c4a7143)
Diffstat (limited to 'source3/smbd/password.c')
-rw-r--r--source3/smbd/password.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 45d4d72863..3ab963bfa8 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -157,14 +157,16 @@ int setup_groups(char *user, uid_t uid, gid_t gid, int *p_ngroups, gid_t **p_gro
{
int i,ngroups;
gid_t grp = 0;
- gid_t *groups = NULL;
+ gid_t *groups = NULL;
- if (-1 == initgroups(user,gid)) {
- if (getuid() == 0) {
+ if (-1 == initgroups(user,gid))
+ {
+ if (getuid() == 0)
+ {
DEBUG(0,("Unable to initgroups!\n"));
- if (gid < 0 || gid > 16000 || uid < 0 || uid > 16000) {
- DEBUG(0,("This is probably a problem with the account %s\n",
- user));
+ if (gid < 0 || gid > 16000 || uid < 0 || uid > 16000)
+ {
+ DEBUG(0,("This is probably a problem with the account %s\n", user));
}
}
return -1;
@@ -172,20 +174,24 @@ int setup_groups(char *user, uid_t uid, gid_t gid, int *p_ngroups, gid_t **p_gro
ngroups = sys_getgroups(0,&grp);
if (ngroups <= 0)
- ngroups = 32;
+ {
+ ngroups = 32;
+ }
- if((groups = (gid_t *)malloc(sizeof(gid_t)*ngroups)) == NULL) {
- DEBUG(0,("setup_groups malloc fail !\n"));
- return -1;
- }
+ if((groups = (gid_t *)malloc(sizeof(gid_t)*ngroups)) == NULL)
+ {
+ DEBUG(0,("setup_groups malloc fail !\n"));
+ return -1;
+ }
- ngroups = sys_getgroups(ngroups,groups);
+ ngroups = sys_getgroups(ngroups,groups);
(*p_ngroups) = ngroups;
(*p_groups) = groups;
DEBUG( 3, ( "%s is in %d groups: ", user, ngroups ) );
- for (i = 0; i < ngroups; i++ ) {
+ for (i = 0; i < ngroups; i++ )
+ {
DEBUG( 3, ( "%s%d", (i ? ", " : ""), (int)groups[i] ) );
}
DEBUG( 3, ( "\n" ) );