diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/chgpasswd.c | 17 | ||||
-rw-r--r-- | source3/smbd/password.c | 17 | ||||
-rw-r--r-- | source3/smbd/server.c | 11 | ||||
-rw-r--r-- | source3/smbd/uid.c | 2 |
4 files changed, 18 insertions, 29 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index 894762b707..560d989b47 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -74,7 +74,13 @@ static int findpty(char **slave) grantpt(master); unlockpt(master); *slave = ptsname(master); - return (master); + if(*slave == NULL) { + DEBUG(0,("findpty: Unable to create master/slave pty pair.\n")); + return -1; + } else { + DEBUG(10, ("findpty: Allocated slave pty %s\n", *slave)); + return (master); + } } #else /* USE_GRANTPT */ fstrcpy( line, "/dev/ptyXX" ); @@ -197,6 +203,8 @@ static int dochild(int master,char *slavedev, char *name, char *passwordprogram, #endif } + DEBUG(10, ("Invoking '%s' as password change program.\n", passwordprogram)); + /* execl() password-change application */ if (execl("/bin/sh","sh","-c",passwordprogram,NULL) < 0) { DEBUG(3,("Bad status returned from %s\n",passwordprogram)); @@ -297,7 +305,7 @@ BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence, BOOL int master; pid_t pid, wpid; int wstat; - BOOL chstat; + BOOL chstat = False; /* allocate a pseudo-terminal device */ if ((master = findpty (&slavedev)) < 0) { @@ -315,7 +323,6 @@ BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence, BOOL if ((chstat = talktochild(master, chatsequence)) == False) { DEBUG(3,("Child failed to change password: %s\n",name)); kill(pid, SIGKILL); /* be sure to end this process */ - return(False); } if ((wpid = sys_waitpid(pid, &wstat, 0)) < 0) { DEBUG(3,("The process is no longer waiting!\n\n")); @@ -348,7 +355,9 @@ BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence, BOOL if(as_root) unbecome_root(False); } - DEBUG(3,("Password change %ssuccessful for user %s\n", (chstat?"":"un"), name)); + + if(chstat) + DEBUG(3,("Password change %ssuccessful for user %s\n", (chstat?"":"un"), name)); return (chstat); } diff --git a/source3/smbd/password.c b/source3/smbd/password.c index e160580e5f..711729f86d 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -134,17 +134,15 @@ void invalidate_vuid(uint16 vuid) vuser->n_sids = 0; - /* same number of igroups as groups as attrs */ + /* same number of igroups as groups */ vuser->n_groups = 0; if (vuser->groups && (vuser->groups != (gid_t *)vuser->igroups)) free(vuser->groups); if (vuser->igroups) free(vuser->igroups); - if (vuser->attrs ) free(vuser->attrs); if (vuser->sids ) free(vuser->sids); - vuser->attrs = NULL; vuser->sids = NULL; vuser->igroups = NULL; vuser->groups = NULL; @@ -167,8 +165,7 @@ char *validated_username(uint16 vuid) Setup the groups a user belongs to. ****************************************************************************/ int setup_groups(char *user, int uid, int gid, int *p_ngroups, - int **p_igroups, gid_t **p_groups, - int **p_attrs) + int **p_igroups, gid_t **p_groups) { if (-1 == initgroups(user,gid)) { @@ -183,25 +180,19 @@ int setup_groups(char *user, int uid, int gid, int *p_ngroups, { int i,ngroups; int *igroups; - int *attrs; gid_t grp = 0; ngroups = getgroups(0,&grp); if (ngroups <= 0) ngroups = 32; igroups = (int *)malloc(sizeof(int)*ngroups); - attrs = (int *)malloc(sizeof(int)*ngroups); for (i=0;i<ngroups;i++) - { - attrs [i] = 0x7; /* XXXX don't know what NT user attributes are yet! */ igroups[i] = 0x42424242; - } ngroups = getgroups(ngroups,(gid_t *)igroups); if (igroups[0] == 0x42424242) ngroups = 0; *p_ngroups = ngroups; - *p_attrs = attrs; /* The following bit of code is very strange. It is due to the fact that some OSes use int* and some use gid_t* for @@ -309,15 +300,13 @@ uint16 register_vuid(int uid,int gid, char *unix_name, char *requested_name, BOO vuser->n_groups = 0; vuser->groups = NULL; vuser->igroups = NULL; - vuser->attrs = NULL; /* Find all the groups this uid is in and store them. Used by become_user() */ setup_groups(unix_name,uid,gid, &vuser->n_groups, &vuser->igroups, - &vuser->groups, - &vuser->attrs); + &vuser->groups); DEBUG(3,("uid %d registered to name %s\n",uid,unix_name)); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 62ee75db0a..49ce759945 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -3864,13 +3864,12 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de pcon->ngroups = 0; pcon->igroups = NULL; pcon->groups = NULL; - pcon->attrs = NULL; if (!IS_IPC(cnum)) { /* Find all the groups this uid is in and store them. Used by become_user() */ setup_groups(pcon->user,pcon->uid,pcon->gid, - &pcon->ngroups,&pcon->igroups,&pcon->groups,&pcon->attrs); + &pcon->ngroups,&pcon->igroups,&pcon->groups); /* check number of connections */ if (!claim_connection(cnum, @@ -4235,11 +4234,7 @@ reply for the nt protocol int reply_nt1(char *outbuf) { /* dual names + lock_and_read + nt SMBs + remote API calls */ - int capabilities = CAP_NT_FIND|CAP_LOCK_AND_READ|CAP_RPC_REMOTE_APIS -#ifdef HAVE_NT_SMBS - |CAP_NT_SMBS -#endif /* HAVE_NT_SMBS */ - ; + int capabilities = CAP_NT_FIND|CAP_LOCK_AND_READ|CAP_RPC_REMOTE_APIS |CAP_NT_SMBS; /* other valid capabilities which we may support at some time... @@ -4810,13 +4805,11 @@ struct smb_message_struct {SMBtrans2, "SMBtrans2", reply_trans2, AS_USER }, {SMBtranss2, "SMBtranss2", reply_transs2, AS_USER}, -#ifdef HAVE_NT_SMBS /* NT PROTOCOL FOLLOWS */ {SMBntcreateX, "SMBntcreateX", reply_ntcreate_and_X, AS_USER | CAN_IPC | QUEUE_IN_OPLOCK }, {SMBnttrans, "SMBnttrans", reply_nttrans, AS_USER | CAN_IPC }, {SMBnttranss, "SMBnttranss", reply_nttranss, AS_USER | CAN_IPC }, {SMBntcancel, "SMBntcancel", reply_ntcancel, AS_USER }, -#endif /* HAVE_NT_SMBS */ /* messaging routines */ {SMBsends,"SMBsends",reply_sends,AS_GUEST}, diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 358de86875..2a75b660b5 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -369,7 +369,6 @@ BOOL become_user(connection_struct *conn, int cnum, uint16 vuid) current_user.groups = conn->groups; current_user.igroups = conn->igroups; current_user.ngroups = conn->ngroups; - current_user.attrs = conn->attrs; } else { @@ -385,7 +384,6 @@ BOOL become_user(connection_struct *conn, int cnum, uint16 vuid) current_user.ngroups = vuser->n_groups; current_user.groups = vuser->groups; current_user.igroups = vuser->igroups; - current_user.attrs = vuser->attrs; } if (initial_uid == 0) |