split the username in the vuser structure into a separate
authorAndrew Tridgell <tridge@samba.org>
Tue, 2 May 2000 13:55:42 +0000 (13:55 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 2 May 2000 13:55:42 +0000 (13:55 +0000)
userdom_struct. As the name implies this also contains a domain
(unused at the moment).

This will be important shortly, as operation in appliance mode needs
the domain to be always carried with the username.

source/include/smb.h
source/lib/substitute.c
source/locking/posix.c
source/param/loadparm.c
source/rpc_server/srv_netlog.c
source/rpc_server/srv_pipe_hnd.c
source/smbd/lanman.c
source/smbd/password.c
source/smbd/process.c
source/smbd/uid.c

index f61c8cbbadc851a0dd2f6b8c49782ae25c0cb226..a03d7a0bcb96f980f6f464a154f1a4b6c47f3385 100644 (file)
@@ -603,14 +603,19 @@ struct dcinfo
 };
 
 
+typedef struct {
+       fstring smb_name; /* user name from the client */
+       fstring unix_name; /* unix user name of a validated user */
+       fstring real_name; /* to store real name from password file - simeon */
+       fstring domain; /* domain that the client specified */
+} userdom_struct;
+
 typedef struct
 {
        uid_t uid; /* uid of a validated user */
        gid_t gid; /* gid of a validated user */
 
-       fstring requested_name; /* user name from the client */
-       fstring name; /* unix user name of a validated user */
-       fstring real_name;   /* to store real name from password file - simeon */
+       userdom_struct user;
        BOOL guest;
 
        /* following groups stuff added by ih */
index 2a575f0c3820238f3a8f2bfdc2170b5d91b69916..a23f613814e25fb89d3a1a37427a87ba6f3cc977 100644 (file)
@@ -280,7 +280,7 @@ void standard_sub_snum(int snum, char *str)
 ********************************************************************/
 void standard_sub_vuser(char *str, user_struct *vuser)
 {
-       standard_sub_advanced(-1, vuser->name, "", -1, str);
+       standard_sub_advanced(-1, vuser->user.unix_name, "", -1, str);
 }
 
 /*******************************************************************
@@ -288,6 +288,6 @@ void standard_sub_vuser(char *str, user_struct *vuser)
 ********************************************************************/
 void standard_sub_vsnum(char *str, user_struct *vuser, int snum)
 {
-       standard_sub_advanced(snum, vuser->name, "", -1, str);
+       standard_sub_advanced(snum, vuser->user.unix_name, "", -1, str);
 }
 
index 094cb87bc8f38c4fb4d7d9a59a5a579a5d180fb8..ab58607172aaa60d1b996bb85175209059274f9f 100644 (file)
@@ -611,10 +611,10 @@ static BOOL posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out,
        return True;
 }
 
+#if defined(LARGE_SMB_OFF_T)
 /****************************************************************************
  Pathetically try and map a 64 bit lock offset into 31 bits. I hate Windows :-).
 ****************************************************************************/
-
 static uint32 map_lock_offset(uint32 high, uint32 low)
 {
        unsigned int i;
@@ -642,6 +642,7 @@ static uint32 map_lock_offset(uint32 high, uint32 low)
 
        return (high|low);
 }
+#endif
 
 /****************************************************************************
  Actual function that does POSIX locks. Copes with 64 -> 32 bit cruft and
index ff19f34a0e94665cea8748436bf7f541ef84a965..1294eda45cdfabb227d1eb31eeadec396744394a 100644 (file)
@@ -995,7 +995,7 @@ static void init_globals(void)
   Globals.shmem_size = SHMEM_SIZE;
   Globals.stat_cache_size = 50; /* Number of stat translations we'll keep */
   Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
-  Globals.bUnixRealname = False;
+  Globals.bUnixRealname = True;
 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
   Globals.bNISHomeMap = False;
 #ifdef WITH_NISPLUS_HOME
index a198b6b98a5778c78e375ba9affd25c16cd8d2a8..82573f7952f83be56607e6c6bdf60b24e9e76e14 100644 (file)
@@ -808,7 +808,7 @@ static BOOL api_net_sam_logon(prs_struct *data, prs_struct *rdata)
                                 &dummy_time, /* pass_must_change_time */
                                 
                                 nt_username   , /* user_name */
-                                vuser->real_name, /* full_name */
+                                vuser->user.real_name, /* full_name */
                                 logon_script    , /* logon_script */
                                 profile_path    , /* profile_path */
                                 home_dir        , /* home_dir */
index 7110342383fb6a93904ce68c57ab7739f6ba9a30..35fb0423a5ecf603e6121c4f5e00fd0668d14923 100644 (file)
@@ -120,8 +120,8 @@ static void attempt_remote_rpc_connect(pipes_struct *p)
        ZERO_STRUCT(usr);
 
        /* set up unix credentials from the smb side, to feed over the pipe */
-       make_creds_unix(&usr.uxc, vuser->name, vuser->requested_name,
-                                       vuser->real_name, vuser->guest);
+       make_creds_unix(&usr.uxc, vuser->user.unix_name, vuser->user.smb_name,
+                                       vuser->user.real_name, vuser->guest);
        usr.ptr_uxc = 1;
        make_creds_unix_sec(&usr.uxs, vuser->uid, vuser->gid,
                                        vuser->n_groups, vuser->groups);
index 9774305fc92acdd8d868691b261aa18bcf9718d0..2ec08ddbf9489a6f936992eff4fa363c8a0826dd 100644 (file)
@@ -2285,7 +2285,8 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param
        Don't depend on vuser being non-null !!. JRA */
     user_struct *vuser = get_valid_user_struct(vuid);
     if(vuser != NULL)
-      DEBUG(3,("  Username of UID %d is %s\n", (int)vuser->uid, vuser->name));
+      DEBUG(3,("  Username of UID %d is %s\n", (int)vuser->uid, 
+              vuser->user.unix_name));
 
     *rparam_len = 6;
     *rparam = REALLOC(*rparam,*rparam_len);
@@ -2335,7 +2336,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param
 
                /* EEK! the cifsrap.txt doesn't have this in!!!! */
                SIVAL(p,usri11_full_name,PTR_DIFF(p2,p)); /* full name */
-               pstrcpy(p2,((vuser != NULL) ? vuser->real_name : UserName));
+               pstrcpy(p2,((vuser != NULL) ? vuser->user.real_name : UserName));
                p2 = skip_string(p2,1);
        }
 
@@ -2394,7 +2395,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param
                {
                        SIVAL(p,60,0);          /* auth_flags */
                        SIVAL(p,64,PTR_DIFF(p2,*rdata)); /* full_name */
-                       pstrcpy(p2,((vuser != NULL) ? vuser->real_name : UserName));
+                       pstrcpy(p2,((vuser != NULL) ? vuser->user.real_name : UserName));
                        p2 = skip_string(p2,1);
                        SIVAL(p,68,0);          /* urs_comment */
                        SIVAL(p,72,PTR_DIFF(p2,*rdata)); /* parms */
index a8b9050030f0f7dacfbbaad155e6c33cfd4ab22a..cff47c0a9434fc24d1024e28f559582b84e0aa66 100644 (file)
@@ -140,7 +140,7 @@ char *validated_username(uint16 vuid)
   user_struct *vuser = get_valid_user_struct(vuid);
   if (vuser == NULL)
     return 0;
-  return(vuser->name);
+  return(vuser->user.unix_name);
 }
 
 
@@ -246,8 +246,8 @@ uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name,
   vuser->uid = uid;
   vuser->gid = gid;
   vuser->guest = guest;
-  fstrcpy(vuser->name,unix_name);
-  fstrcpy(vuser->requested_name,requested_name);
+  fstrcpy(vuser->user.unix_name,unix_name);
+  fstrcpy(vuser->user.smb_name,requested_name);
 
   vuser->n_groups = 0;
   vuser->groups  = NULL;
@@ -261,12 +261,12 @@ uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name,
   DEBUG(3,("uid %d registered to name %s\n",(int)uid,unix_name));
 
   DEBUG(3, ("Clearing default real name\n"));
-  fstrcpy(vuser->real_name, "<Full Name>\0");
+  fstrcpy(vuser->user.real_name, "<Full Name>");
   if (lp_unix_realname()) {
-    if ((pwfile=sys_getpwnam(vuser->name))!= NULL)
+    if ((pwfile=sys_getpwnam(vuser->user.unix_name))!= NULL)
       {
-      DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->name,pwfile->pw_gecos));
-      fstrcpy(vuser->real_name, pwfile->pw_gecos);
+      DEBUG(3, ("User name: %s\tReal name: %s\n",vuser->user.unix_name,pwfile->pw_gecos));
+      fstrcpy(vuser->user.real_name, pwfile->pw_gecos);
       }
   }
 
@@ -707,9 +707,9 @@ BOOL authorise_login(int snum,char *user,char *password, int pwlen,
 
       /* check for a previously registered guest username */
       if (!ok && (vuser != 0) && vuser->guest) {         
-       if (user_ok(vuser->name,snum) &&
-           password_ok(vuser->name, password, pwlen, NULL)) {
-         fstrcpy(user, vuser->name);
+       if (user_ok(vuser->user.unix_name,snum) &&
+           password_ok(vuser->user.unix_name, password, pwlen, NULL)) {
+         fstrcpy(user, vuser->user.unix_name);
          vuser->guest = False;
          DEBUG(3,("ACCEPTED: given password with registered user %s\n", user));
          ok = True;
@@ -744,8 +744,8 @@ BOOL authorise_login(int snum,char *user,char *password, int pwlen,
     /* check for a previously validated username/password pair */
     if (!ok && (!lp_revalidate(snum) || lp_security() > SEC_SHARE) &&
         (vuser != 0) && !vuser->guest &&
-        user_ok(vuser->name,snum)) {
-      fstrcpy(user,vuser->name);
+        user_ok(vuser->user.unix_name,snum)) {
+      fstrcpy(user,vuser->user.unix_name);
       *guest = False;
       DEBUG(3,("ACCEPTED: validated uid ok as non-guest\n"));
       ok = True;
index 1eb58996678aff8511922e355d555630f5d1bc8a..6482ccd53899790e00478f61193e771b998bd8de 100644 (file)
@@ -495,7 +495,7 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
         if(session_tag != UID_FIELD_INVALID)
           vuser = get_valid_user_struct(session_tag);           
         if(vuser != NULL)
-          pstrcpy( sesssetup_user, vuser->requested_name);
+          pstrcpy( sesssetup_user, vuser->user.smb_name);
       }
 
       /* does this protocol need to be run as root? */
index ce0631e418a26b48a5d740006b657b7564f9df5c..28d2fb71f604d273e726525b699f5a249ee1b88a 100644 (file)
@@ -140,7 +140,7 @@ static BOOL check_user_ok(connection_struct *conn, user_struct *vuser,int snum)
   for (i=0;i<conn->uid_cache.entries;i++)
     if (conn->uid_cache.list[i] == vuser->uid) return(True);
 
-  if (!user_ok(vuser->name,snum)) return(False);
+  if (!user_ok(vuser->user.unix_name,snum)) return(False);
 
   i = conn->uid_cache.entries % UID_CACHE_SIZE;
   conn->uid_cache.list[i] = vuser->uid;