Makefile: Added AIX 3.2.5.
authorJeremy Allison <jra@samba.org>
Wed, 11 Feb 1998 11:07:14 +0000 (11:07 +0000)
committerJeremy Allison <jra@samba.org>
Wed, 11 Feb 1998 11:07:14 +0000 (11:07 +0000)
loadparm.c: Added "win95 bug compatibility" parameter.
local.h: Replaced MAX_OPEN_FILES back to 100 from 10 (oops).
reply.c: Fixed ulogoff check against uid - changed to vuid.
server.c: Changed file struct save of uid - changed to vuid.
smb.h: Changed id in struct current_user to vuid.
       Changed file struct uid to vuid.
time.c: Added "win95 bug compatibility" atime -> mtime return.
trans2.c: Added "win95 bug compatibility" fixes.
uid.c: Changed id in struct current_user to vuid - added checks
       to set/reset it.
util.c: Added code to expand environment variables.
version.h : still at 1.9.18 (head branch doesn't matter too much at present).
Jeremy.

source/include/local.h
source/include/proto.h
source/include/smb.h
source/lib/time.c
source/lib/util.c
source/param/loadparm.c
source/smbd/reply.c
source/smbd/server.c
source/smbd/trans2.c
source/smbd/uid.c

index b2a8f5ec578bb2353ae9c48945ca93a71439d0a2..22862a9a1ffa7b38f367f9378bcfb0c7ff270538 100644 (file)
@@ -27,7 +27,7 @@
    MAX_CONNECTIONS services, but any number of machines may connect at
    one time. */
 #define MAX_CONNECTIONS 127
-#define MAX_OPEN_FILES 10
+#define MAX_OPEN_FILES 100
 
 /* Default size of shared memory used for share mode locking */
 #ifndef SHMEM_SIZE
index 7f6321c869f4fe5a53d796da9a4f16a6cba52626..306d3a42a0c8ef05296c5077ecdd1d1983b7c1b2 100644 (file)
@@ -280,6 +280,7 @@ BOOL lp_nis_home_map(void);
 BOOL lp_time_server(void);
 BOOL lp_bind_interfaces_only(void);
 BOOL lp_net_wksta_user_logon(void);
+BOOL lp_win95_bug_compatibility(void);
 int lp_os_level(void);
 int lp_max_ttl(void);
 int lp_max_wins_ttl(void);
index 9a7278069d4ab22384497c2fd340f6826349eb05..77f4006c4aa2a6b7fe46f93dd3db9e0f0b4005d5 100644 (file)
@@ -1366,7 +1366,7 @@ struct cli_state {
 
 struct current_user
 {
-  int cnum, id;
+  int cnum, vuid;
   int uid, gid;
   int ngroups;
   gid_t *groups;
@@ -1424,7 +1424,7 @@ typedef struct
   int pos;
   uint32 size;
   int mode;
-  int uid;
+  int vuid;
   char *mmap_ptr;
   uint32 mmap_size;
   write_bmpx_struct *wbmpx_ptr;
index 62a7016994d717ee0d515497fcaa6efaacb9e987..81e3dcfd8f128f97f73e2a3767a8317b95f26fc1 100644 (file)
@@ -508,5 +508,8 @@ time_t get_create_time(struct stat *st)
     
 time_t get_access_time(struct stat *st)
 {
-  return st->st_atime;
+  if (lp_win95_bug_compatibility())
+    return st->st_mtime;
+  else
+    return st->st_atime;
 }
index 1d65269f952800fdd28f11633e59712be84374e4..3b30f1e6b5b2c84cb28978342833deb30c6d3525 100644 (file)
@@ -3811,6 +3811,38 @@ void standard_sub_basic(char *str)
                        case 'h' : string_sub(p,"%h", myhostname); break;
                        case 'm' : string_sub(p,"%m", remote_machine); break;
                        case 'v' : string_sub(p,"%v", VERSION); break;
+                        case '$' : /* Expand environment variables */
+                        {
+                          /* Contributed by Branko Cibej <branko.cibej@hermes.si> */
+                          fstring envname;
+                          char *envval;
+                          char *q, *r;
+                          int copylen;
+                          if (*(p+2) != '(') { p+=2; break; }
+                          if ((q = strchr(p,')')) == NULL)
+                          {
+                            DEBUG(0,("standard_sub_basic: Unterminated environment \
+variable [%s]\n", p));
+                            p+=2; break;
+                          }
+                          r = p+3;
+                          copylen = MIN((q-r),(sizeof(envname)-1));
+                          strncpy(envname,r,copylen);
+                          envname[copylen] = '\0';
+                          if ((envval = getenv(envname)) == NULL)
+                          {
+                            DEBUG(0,("standard_sub_basic: Environment variable [%s] not set\n",
+                                     envname));
+                            p+=2; break;
+                          }
+                          copylen = MIN((q+1-p),(sizeof(envname)-1));
+                          strncpy(envname,p,copylen);
+                          envname[copylen] = '\0';
+                          string_sub(p,envname,envval);
+                          break;
+                        }
                        case '\0': p++; break; /* don't run off end if last character is % */
                        default  : p+=2; break;
                }
index 0e55bc4ac17ec34c039880ea94029d41db906910..82a485144426d31b6326d3a48eec5cb6f39cdb0c 100644 (file)
@@ -189,6 +189,7 @@ typedef struct
   BOOL bTimeServer;
   BOOL bBindInterfacesOnly;
   BOOL bNetWkstaUserLogon;
+  BOOL bWin95BugCompatibility;
 } global;
 
 static global Globals;
@@ -530,6 +531,7 @@ static struct parm_struct
   {"unix realname",    P_BOOL,    P_GLOBAL, &Globals.bUnixRealname,     NULL,   NULL},
   {"NIS homedir",      P_BOOL,    P_GLOBAL, &Globals.bNISHomeMap,       NULL,   NULL},
   {"time server",      P_BOOL,    P_GLOBAL, &Globals.bTimeServer,      NULL,   NULL},
+  {"win95 bug compatibility", P_BOOL,    P_GLOBAL, &Globals.bWin95BugCompatibility,NULL,   NULL},
   {"printer driver file", P_STRING,  P_GLOBAL, &Globals.szDriverFile,   NULL,   NULL},
   {"-valid",           P_BOOL,    P_LOCAL,  &sDefault.valid,            NULL,   NULL},
   {"comment",          P_STRING,  P_LOCAL,  &sDefault.comment,          NULL,   NULL},
@@ -723,6 +725,7 @@ static void init_globals(void)
   Globals.bTimeServer = False;
   Globals.bBindInterfacesOnly = False;
   Globals.bNetWkstaUserLogon = True;
+  Globals.bWin95BugCompatibility = False;
 
 /* these parameters are set to defaults that are more appropriate
    for the increasing samba install base:
@@ -939,6 +942,7 @@ FN_GLOBAL_BOOL(lp_nis_home_map,&Globals.bNISHomeMap)
 FN_GLOBAL_BOOL(lp_time_server,&Globals.bTimeServer)
 FN_GLOBAL_BOOL(lp_bind_interfaces_only,&Globals.bBindInterfacesOnly)
 FN_GLOBAL_BOOL(lp_net_wksta_user_logon,&Globals.bNetWkstaUserLogon)
+FN_GLOBAL_BOOL(lp_win95_bug_compatibility,&Globals.bWin95BugCompatibility)
 
 FN_GLOBAL_INTEGER(lp_os_level,&Globals.os_level)
 FN_GLOBAL_INTEGER(lp_max_ttl,&Globals.max_ttl)
index db494d07dbd6869329c9cd6702368c79ec14e9ab..93bb679289cde842034a80f6b9817ac8673db6af 100644 (file)
@@ -1385,7 +1385,7 @@ int reply_ulogoffX(char *inbuf,char *outbuf,int length,int bufsize)
   if ((vuser != 0) && (lp_security() != SEC_SHARE)) {
     int i;
     for (i=0;i<MAX_OPEN_FILES;i++)
-      if (Files[i].uid == vuser->uid && Files[i].open) {
+      if ((Files[i].vuid == vuid) && Files[i].open) {
        close_file(i,False);
       }
   }
index 94360a4c373c146a0a0dedcdd89e342106780db6..0a6a05fdbfebf7b4ad16d57f47e7928a1d7a6d6a 100644 (file)
@@ -1344,7 +1344,7 @@ static void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct
       Connections[cnum].num_files_open++;
       fsp->mode = sbuf->st_mode;
       GetTimeOfDay(&fsp->open_time);
-      fsp->uid = current_user.id;
+      fsp->vuid = current_user.vuid;
       fsp->size = 0;
       fsp->pos = -1;
       fsp->open = True;
index 825dd0a25e07a384c65ea2608385e72afdb4a557..2b5d5785fa0ead2df60f05bdda71e00d33efc716 100644 (file)
@@ -32,6 +32,7 @@ extern BOOL case_sensitive;
 extern int Client;
 extern int oplock_sock;
 extern int smb_read_error;
+extern fstring local_machine;
 
 /****************************************************************************
   Send the required number of replies back.
@@ -940,7 +941,8 @@ static int call_trans2qfsinfo(char *inbuf, char *outbuf, int length, int bufsize
   int data_len;
   struct stat st;
   char *vname = volume_label(SNUM(cnum));
-  
+  int snum = SNUM(cnum);
   DEBUG(3,("call_trans2qfsinfo: cnum = %d, level = %d\n", cnum, info_level));
 
   if(sys_stat(".",&st)!=0) {
@@ -971,7 +973,11 @@ static int call_trans2qfsinfo(char *inbuf, char *outbuf, int length, int bufsize
       /* Return volume name */
       int volname_len = MIN(strlen(vname),11);
       data_len = l2_vol_szVolLabel + volname_len + 1;
-      put_dos_date2(pdata,l2_vol_fdateCreation,st.st_ctime);
+      /* 
+       * Add volume serial number - hash of a combination of
+       * the called hostname and the service name.
+       */
+      SIVAL(pdata,0,str_checksum(lp_servicename(snum)) ^ str_checksum(local_machine) );
       SCVAL(pdata,l2_vol_cch,volname_len);
       StrnCpy(pdata+l2_vol_szVolLabel,vname,volname_len);
       DEBUG(5,("call_trans2qfsinfo : time = %x, namelen = %d, name = %s\n",st.st_ctime, volname_len,
@@ -992,6 +998,11 @@ static int call_trans2qfsinfo(char *inbuf, char *outbuf, int length, int bufsize
       break;
     case SMB_QUERY_FS_VOLUME_INFO:      
       data_len = 18 + 2*strlen(vname);
+      /* 
+       * Add volume serial number - hash of a combination of
+       * the called hostname and the service name.
+       */
+      SIVAL(pdata,8,str_checksum(lp_servicename(snum)) ^ str_checksum(local_machine) );
       SIVAL(pdata,12,2*strlen(vname));
       PutUniCode(pdata+18,vname);      
       DEBUG(5,("call_trans2qfsinfo : SMB_QUERY_FS_VOLUME_INFO namelen = %d, vol = %s\n", strlen(vname),
@@ -1128,9 +1139,18 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length,
     case SMB_INFO_STANDARD:
     case SMB_INFO_QUERY_EA_SIZE:
       data_size = (info_level==1?22:26);
-      put_dos_date2(pdata,l1_fdateCreation,get_create_time(&sbuf));
-      put_dos_date2(pdata,l1_fdateLastAccess,get_access_time(&sbuf));
-      put_dos_date2(pdata,l1_fdateLastWrite,sbuf.st_mtime); /* write time */
+      if( lp_win95_bug_compatibility())
+      {
+        put_dos_date(pdata,l1_fdateCreation,get_create_time(&sbuf));
+        put_dos_date(pdata,l1_fdateLastAccess,get_access_time(&sbuf));
+        put_dos_date(pdata,l1_fdateLastWrite,sbuf.st_mtime); /* write time */
+      }
+      else
+      {
+        put_dos_date2(pdata,l1_fdateCreation,get_create_time(&sbuf));
+        put_dos_date2(pdata,l1_fdateLastAccess,get_access_time(&sbuf));
+        put_dos_date2(pdata,l1_fdateLastWrite,sbuf.st_mtime); /* write time */
+      }
       SIVAL(pdata,l1_cbFile,size);
       SIVAL(pdata,l1_cbFileAlloc,ROUNDUP(size,1024));
       SSVAL(pdata,l1_attrFile,mode);
index 176f6ca2404a07a3e724ec32cb97da9d05f79601..14b0000f59401685052b0d4df34f8a44f90c1e9c 100644 (file)
@@ -53,6 +53,7 @@ void init_uid(void)
   initial_gid = getegid();
 
   current_user.cnum = -1;
+  current_user.vuid = UID_FIELD_INVALID;
 
   ChDir(OriginalDir);
 }
@@ -174,6 +175,7 @@ BOOL become_guest(void)
     DEBUG(1,("Failed to become guest. Invalid guest account?\n"));
 
   current_user.cnum = -2;
+  current_user.vuid = UID_FIELD_INVALID;
 
   return(ret);
 }
@@ -208,7 +210,8 @@ BOOL become_user(connection_struct *conn, int cnum, uint16 vuid)
   int snum,gid;
   int uid;
 
-  if (current_user.cnum == cnum && vuser != 0 && current_user.id == vuser->uid) {
+  if ((current_user.cnum == cnum) && (vuser != 0) && (current_user.vuid == vuid) && 
+      (current_user.uid == vuser->uid)) {
     DEBUG(4,("Skipping become_user - already user\n"));
     return(True);
   }
@@ -272,7 +275,7 @@ BOOL become_user(connection_struct *conn, int cnum, uint16 vuid)
     }
 
   current_user.cnum = cnum;
-  current_user.id = uid;
+  current_user.vuid = vuid;
   
   DEBUG(5,("become_user uid=(%d,%d) gid=(%d,%d)\n",
           getuid(),geteuid(),getgid(),getegid()));
@@ -333,6 +336,7 @@ BOOL unbecome_user(void )
        getuid(),geteuid(),getgid(),getegid()));
 
   current_user.cnum = -1;
+  current_user.vuid = UID_FIELD_INVALID;
 
   return(True);
 }