summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-02-11 11:07:14 +0000
committerJeremy Allison <jra@samba.org>1998-02-11 11:07:14 +0000
commit99e11e171e40703271ad2a7934708cee66b0bb82 (patch)
treeed892bbc53c3155d43e583ced1a59d47623fa1af /source3/smbd
parent5546e28e69b1a43dbb48e024e233d8ebf7fa667a (diff)
downloadsamba-99e11e171e40703271ad2a7934708cee66b0bb82.tar.gz
samba-99e11e171e40703271ad2a7934708cee66b0bb82.tar.bz2
samba-99e11e171e40703271ad2a7934708cee66b0bb82.zip
Makefile: Added AIX 3.2.5.
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. (This used to be commit adc903bcf59ad1664babd7f1d43675d3a75bfbc9)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/reply.c2
-rw-r--r--source3/smbd/server.c2
-rw-r--r--source3/smbd/trans2.c30
-rw-r--r--source3/smbd/uid.c8
4 files changed, 33 insertions, 9 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index db494d07db..93bb679289 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -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);
}
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 94360a4c37..0a6a05fdbf 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -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;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 825dd0a25e..2b5d5785fa 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -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);
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 176f6ca240..14b0000f59 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -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);
}