summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-02-02 18:12:36 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-02-02 18:12:36 +0000
commit98bf10bc5df6eb1c3b71d51cc60ef4bf25f57d97 (patch)
tree8b58f68487342ad1b688be2cbf205fe3e13cfeea
parent2831c627740c80d4ea1187058b249e1d5b5e5c58 (diff)
downloadsamba-98bf10bc5df6eb1c3b71d51cc60ef4bf25f57d97.tar.gz
samba-98bf10bc5df6eb1c3b71d51cc60ef4bf25f57d97.tar.bz2
samba-98bf10bc5df6eb1c3b71d51cc60ef4bf25f57d97.zip
util.c: StrCaseCmp and StrnCaseCmp terminated incorrectly, giving false
answers when a string was partially identical. this issue is still outstanding, and needs to be investigated further. loadparm.c: added lp_logon_path() parameter. ipc.c: in NetUserGetInfo, lp_logon_path() can be returned instead of always specifying \\SAMBA_SERVER\HOMES (which may not necessarily exist). it is now possible to specify lp_logon_path() as \\ARBITRARY_SERVER\%U, just like NT server can. the default is \\SAMBA_SERVER\HOMES, just like it used to be. lkcl (This used to be commit d5b6ad7cb87d6b1a9342f027ac4f57ffdb54b4f3)
-rw-r--r--source3/include/proto.h27
-rw-r--r--source3/lib/util.c21
-rw-r--r--source3/param/loadparm.c3
-rw-r--r--source3/smbd/ipc.c22
4 files changed, 50 insertions, 23 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 70a715cc04..17fadc27e1 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -51,6 +51,7 @@ char *smb_errstr(char *inbuf);
/*The following definitions come from clitar.c */
int strslashcmp(char *s1,char *s2);
+int padit(char *buf, int bufsize, int padsize);
void cmd_block(void);
void cmd_tarmode(void);
void cmd_setmode(void);
@@ -139,6 +140,8 @@ char *lp_domain_controller(void);
char *lp_username_map(void);
char *lp_character_set(void);
char *lp_logon_script(void);
+char *lp_logon_path(void);
+char *lp_veto_files(void);
char *lp_remote_announce(void);
char *lp_wins_server(void);
char *lp_interfaces(void);
@@ -251,15 +254,9 @@ int lp_numservices(void);
void lp_dump(void);
int lp_servicenumber(char *pszServiceName);
char *volume_label(int snum);
-BOOL is_vetoed_name(char *name);
-BOOL is_vetoed_path(char *name);
-char *lp_veto_files(void);
/*The following definitions come from locking.c */
-BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type);
-int file_lock(char *name,int timeout);
-void file_unlock(int fd);
BOOL is_locked(int fnum,int cnum,uint32 count,uint32 offset);
BOOL do_lock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode);
BOOL do_unlock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode);
@@ -538,7 +535,6 @@ BOOL pm_process(char *pszFileName,BOOL (*sfunc)(char *),BOOL (*pfunc)(char *,cha
void generate_next_challenge(char *challenge);
BOOL set_challenge(char *challenge);
BOOL last_challenge(char *challenge);
-int valid_uid(int uid);
user_struct *get_valid_user_struct(uint16 vuid);
void invalidate_vuid(uint16 vuid);
char *validated_username(uint16 vuid);
@@ -659,14 +655,19 @@ int reply_getattrE(char *inbuf,char *outbuf);
/*The following definitions come from server.c */
+void *dflt_sig(void);
+void killkids(void);
mode_t unix_mode(int cnum,int dosmode);
int dos_mode(int cnum,char *path,struct stat *sbuf);
int dos_chmod(int cnum,char *fname,int dosmode,struct stat *st);
-BOOL unix_convert(char *name,int cnum,char *);
+BOOL unix_convert(char *name,int cnum,pstring saved_last_component);
int disk_free(char *path,int *bsize,int *dfree,int *dsize);
int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize);
BOOL check_name(char *name,int cnum);
-void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct stat *st);
+int fd_attempt_open(char *fname, int flags, int mode);
+void fd_attempt_reopen(char *fname, int mode, file_fd_struct *fd_ptr);
+int fd_attempt_close(file_fd_struct *fd_ptr);
+void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct stat *sbuf);
void sync_file(int fnum);
void close_file(int fnum);
BOOL check_file_sharing(int cnum,char *fname);
@@ -704,12 +705,9 @@ int construct_reply(char *inbuf,char *outbuf,int size,int bufsize);
BOOL smb_shm_open( char *file_name, int size);
BOOL smb_shm_close( void );
-smb_shm_offset_t smb_shm_alloc(int size);
BOOL smb_shm_free(smb_shm_offset_t offset);
-smb_shm_offset_t smb_shm_get_userdef_off(void);
BOOL smb_shm_set_userdef_off(smb_shm_offset_t userdef_off);
void * smb_shm_offset2addr(smb_shm_offset_t offset);
-smb_shm_offset_t shm_addr2offset(void *addr);
BOOL smb_shm_lock(void);
BOOL smb_shm_unlock(void);
BOOL smb_shm_get_usage(int *bytes_free,
@@ -926,6 +924,11 @@ char *gidtoname(int gid);
void BlockSignals(BOOL block,int signum);
void ajt_panic(void);
char *readdirname(void *p);
+BOOL is_vetoed_name(char *name);
+BOOL is_vetoed_path(char *name);
+BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type);
+int file_lock(char *name,int timeout);
+void file_unlock(int fd);
/*The following definitions come from vt_mode.c */
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 318ac3fc61..dbf8a377bb 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -796,25 +796,32 @@ char *attrib_string(int mode)
/*******************************************************************
case insensitive string compararison
********************************************************************/
-int StrCaseCmp(char *s, char *t)
+int StrCaseCmp(char const *s, char const *t)
{
- for (; tolower(*s) == tolower(*t); ++s, ++t)
- if (!*s) return 0;
+ /* compare until we run out of string, either t or s, or find a difference */
+ while (*s && *t && tolower(*s) == tolower(*t))
+ {
+ s++; t++;
+ }
- return tolower(*s) - tolower(*t);
+ return(tolower(*s) - tolower(*t));
}
/*******************************************************************
case insensitive string compararison, length limited
********************************************************************/
-int StrnCaseCmp(char *s, char *t, int n)
+int StrnCaseCmp(char const *s, char const *t, int n)
{
- while (n-- && *s && *t) {
- if (tolower(*s) != tolower(*t)) return(tolower(*s) - tolower(*t));
+ /* compare until we run out of string, either t or s, or chars */
+ while (n-- && *s && *t && tolower(*s) == tolower(*t))
+ {
s++; t++;
}
+
+ /* not run out of chars - strings are different lengths */
if (n) return(tolower(*s) - tolower(*t));
+ /* identical up to where we run out of chars, and strings are same length */
return(0);
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 16ef84e38a..67e799a84d 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -128,6 +128,7 @@ typedef struct
char *szUsernameMap;
char *szCharacterSet;
char *szLogonScript;
+ char *szLogonPath;
char *szVetoFiles;
char *szSmbrun;
char *szWINSserver;
@@ -406,6 +407,7 @@ struct parm_struct
{"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL},
{"character set", P_STRING, P_GLOBAL, &Globals.szCharacterSet, handle_character_set},
{"logon script", P_STRING, P_GLOBAL, &Globals.szLogonScript, NULL},
+ {"logon path", P_STRING, P_GLOBAL, &Globals.szLogonPath, NULL},
{"remote announce", P_STRING, P_GLOBAL, &Globals.szRemoteAnnounce, NULL},
{"socket address", P_STRING, P_GLOBAL, &Globals.szSocketAddress, NULL},
{"max log size", P_INTEGER, P_GLOBAL, &Globals.max_log_size, NULL},
@@ -746,6 +748,7 @@ FN_GLOBAL_STRING(lp_domain_controller,&Globals.szDomainController)
FN_GLOBAL_STRING(lp_username_map,&Globals.szUsernameMap)
FN_GLOBAL_STRING(lp_character_set,&Globals.szCharacterSet)
FN_GLOBAL_STRING(lp_logon_script,&Globals.szLogonScript)
+FN_GLOBAL_STRING(lp_logon_path,&Globals.szLogonPath)
FN_GLOBAL_STRING(lp_veto_files,&Globals.szVetoFiles)
FN_GLOBAL_STRING(lp_remote_announce,&Globals.szRemoteAnnounce)
FN_GLOBAL_STRING(lp_wins_server,&Globals.szWINSserver)
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index be500cb40d..1bb1322b5d 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -1845,8 +1845,15 @@ static BOOL api_RNetUserGetInfo(int cnum,uint16 vuid, char *param,char *data,
SIVAL(p,36,0); /* auth flags */
SIVALS(p,40,-1); /* password age */
SIVAL(p,44,PTR_DIFF(p2,p)); /* home dir */
- strcpy(p2,"\\\\%L\\HOMES");
- standard_sub_basic(p2);
+ if (*lp_logon_path())
+ {
+ strcpy(p2,lp_logon_path());
+ }
+ else
+ {
+ strcpy(p2,"\\\\%L\\HOMES");
+ standard_sub_basic(p2);
+ }
p2 = skip_string(p2,1);
SIVAL(p,48,PTR_DIFF(p2,p)); /* parms */
strcpy(p2,"");
@@ -1879,8 +1886,15 @@ static BOOL api_RNetUserGetInfo(int cnum,uint16 vuid, char *param,char *data,
SSVAL(p,42,
Connections[cnum].admin_user?USER_PRIV_ADMIN:USER_PRIV_USER);
SIVAL(p,44,PTR_DIFF(p2,*rdata)); /* home dir */
- strcpy(p2,"\\\\%L\\HOMES");
- standard_sub_basic(p2);
+ if (*lp_logon_path())
+ {
+ strcpy(p2,lp_logon_path());
+ }
+ else
+ {
+ strcpy(p2,"\\\\%L\\HOMES");
+ standard_sub_basic(p2);
+ }
p2 = skip_string(p2,1);
SIVAL(p,48,PTR_DIFF(p2,*rdata)); /* comment */
*p2++ = 0;