chgpasswd.c: Fixed up debug calls to stop crashes if ptsname failed.
authorJeremy Allison <jra@samba.org>
Mon, 27 Jul 1998 18:50:45 +0000 (18:50 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 27 Jul 1998 18:50:45 +0000 (18:50 +0000)
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

source/include/local.h
source/include/proto.h
source/include/smb.h
source/nmbd/nmbd_browsesync.c
source/smbd/chgpasswd.c
source/smbd/password.c
source/smbd/server.c
source/smbd/uid.c

index a55af443ec66becb0284b352bdbf346118ef17b3..0a369d80e29cbb43126041ba6024ac422ccfe7f6 100644 (file)
 
 /* 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
index 8adfb70d38cb559b54cf853a9d020f2da71a71ae..2a7e5ed0801b5b699e4463daa00371f4637c3305 100644 (file)
@@ -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);
index 7079198a4051c242cfbcb012319cf406809d5c7e..3b1796f76b4c77727eda8813b2da5fa6611c2146 100644 (file)
@@ -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;
index dd4a82d7f62f0e1726bbad9e7b0820978f5f9a0d..fd55fe161d87e237f815309c0fa1bd6d11ba7afb 100644 (file)
@@ -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;
index 894762b70778aa84fc3d52b54a69631067bcf578..560d989b478075f25699f5cfee72a15511bee258 100644 (file)
@@ -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);
 }
 
index e160580e5f8db029bd7646a7065659fe27b49b77..711729f86de173380fabdc8c58d9374928632ab3 100644 (file)
@@ -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));
 
index 62ee75db0a57dafe07b2d2245674aa6594ce82d2..49ce759945b1d94e9b1e26c3a8cab55588672bc3 100644 (file)
@@ -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},
index 358de86875fb2182163faa0d09c47896322c6ccc..2a75b660b5eb04026daac70bed902c45a6df0695 100644 (file)
@@ -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)