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.
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
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);
struct current_user
{
- int cnum, id;
+ int cnum, vuid;
int uid, gid;
int ngroups;
gid_t *groups;
int pos;
uint32 size;
int mode;
- int uid;
+ int vuid;
char *mmap_ptr;
uint32 mmap_size;
write_bmpx_struct *wbmpx_ptr;
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;
}
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;
}
BOOL bTimeServer;
BOOL bBindInterfacesOnly;
BOOL bNetWkstaUserLogon;
+ BOOL bWin95BugCompatibility;
} global;
static global Globals;
{"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},
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:
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)
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);
}
}
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;
extern int Client;
extern int oplock_sock;
extern int smb_read_error;
+extern fstring local_machine;
/****************************************************************************
Send the required number of replies back.
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) {
/* 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,
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),
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);
initial_gid = getegid();
current_user.cnum = -1;
+ current_user.vuid = UID_FIELD_INVALID;
ChDir(OriginalDir);
}
DEBUG(1,("Failed to become guest. Invalid guest account?\n"));
current_user.cnum = -2;
+ current_user.vuid = UID_FIELD_INVALID;
return(ret);
}
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);
}
}
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()));
getuid(),geteuid(),getgid(),getegid()));
current_user.cnum = -1;
+ current_user.vuid = UID_FIELD_INVALID;
return(True);
}