From 1aa138922e5c0e4925ff5cbfcdb4e7cad367b31b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 27 Jul 1998 18:50:45 +0000 Subject: chgpasswd.c: Fixed up debug calls to stop crashes if ptsname failed. local.h: Kept FSTYPE_STRING as Samba for now. nmbd_browsesync.c: Added bugfix from Matt Chapman mattyc@cyberdude.com - lmb_browserlist is now a struct ubi_dlList not a struct browse_cache_record *. server.c: smb.h: uid.c: password.c: Removed attrs code - it is not used anywhere. Jeremy (This used to be commit ef1af7fe6d5c58ae57b8e4efff0729e1a315da43) --- source3/include/local.h | 4 ---- source3/include/proto.h | 3 +-- source3/include/smb.h | 3 --- source3/nmbd/nmbd_browsesync.c | 2 +- source3/smbd/chgpasswd.c | 17 +++++++++++++---- source3/smbd/password.c | 17 +++-------------- source3/smbd/server.c | 11 ++--------- source3/smbd/uid.c | 2 -- 8 files changed, 20 insertions(+), 39 deletions(-) diff --git a/source3/include/local.h b/source3/include/local.h index a55af443ec..0a369d80e2 100644 --- a/source3/include/local.h +++ b/source3/include/local.h @@ -85,11 +85,7 @@ /* what type of filesystem do we want this to show up as in a NT file manager window? */ -#ifdef HAVE_NT_SMBS -#define FSTYPE_STRING "NTFS" -#else /* HAVE_NT_SMBS */ #define FSTYPE_STRING "Samba" -#endif /* HAVE_NT_SMBS */ /* the default guest account - normally set in the Makefile or smb.conf */ #ifndef GUEST_ACCOUNT diff --git a/source3/include/proto.h b/source3/include/proto.h index 8adfb70d38..2a7e5ed080 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1668,8 +1668,7 @@ user_struct *get_valid_user_struct(uint16 vuid); void invalidate_vuid(uint16 vuid); char *validated_username(uint16 vuid); 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); uint16 register_vuid(int uid,int gid, char *unix_name, char *requested_name, BOOL guest); void add_session_user(char *user); BOOL update_smbpassword_file( char *user, fstring password); diff --git a/source3/include/smb.h b/source3/include/smb.h index 7079198a40..3b1796f76b 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -398,7 +398,6 @@ struct current_user int ngroups; gid_t *groups; int *igroups; - int *attrs; }; typedef struct @@ -510,7 +509,6 @@ typedef struct int ngroups; gid_t *groups; int *igroups; /* an integer version - some OSes are broken :-( */ - int *attrs; time_t lastused; BOOL used; @@ -548,7 +546,6 @@ typedef struct int n_groups; gid_t *groups; int *igroups; /* an integer version - some OSes are broken :-( */ - int *attrs; /* attributes associated with each gid */ int n_sids; int *sids; diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c index dd4a82d7f6..fd55fe161d 100644 --- a/source3/nmbd/nmbd_browsesync.c +++ b/source3/nmbd/nmbd_browsesync.c @@ -32,7 +32,7 @@ extern pstring global_myname; extern fstring global_myworkgroup; /* This is our local master browser list database. */ -extern struct browse_cache_record *lmb_browserlist; +extern struct ubi_dlList lmb_browserlist[]; static struct work_record *call_work; static struct subnet_record *call_subrec; 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;in_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) -- cgit