diff options
author | Jeremy Allison <jra@samba.org> | 1998-08-14 02:02:40 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-08-14 02:02:40 +0000 |
commit | 3cf6cc6134960c99adb702b21394a4a607cfe30a (patch) | |
tree | b3ce0e9903f2d5ee14a82128a69ed1086509d044 | |
parent | 2ad339b6ff9dc1f55a8f751de56a39bb10846cdf (diff) | |
download | samba-3cf6cc6134960c99adb702b21394a4a607cfe30a.tar.gz samba-3cf6cc6134960c99adb702b21394a4a607cfe30a.tar.bz2 samba-3cf6cc6134960c99adb702b21394a4a607cfe30a.zip |
Makefile.in: Changed so that make proto will work with ldap & nisplus.
locking/locking.c: Made #ifdef'ed out functions static for Make proto.
lib/util.c: Re-instated old mask_match code for UNIX filesystem checks
only. Client calls use the new mask_match code. Changed the
name of the old function to unix_mask_match.
Jeremy.
(This used to be commit b68e756ff57622c6c74f28031d4be964d7b1c9bc)
-rw-r--r-- | source3/Makefile.in | 4 | ||||
-rw-r--r-- | source3/include/proto.h | 31 | ||||
-rw-r--r-- | source3/lib/util.c | 137 | ||||
-rw-r--r-- | source3/locking/locking.c | 6 |
4 files changed, 156 insertions, 22 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index d10b3fd244..fc3f93f2f3 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -122,8 +122,8 @@ PASSDB_OBJ = passdb/passdb.o passdb/smbpassfile.o passdb/smbpass.o \ SMBD_OBJ1 = smbd/server.o smbd/chgpasswd.o smbd/connection.o \ smbd/dfree.o smbd/dir.o smbd/password.o \ - smbd/groupname.o smbd/ipc.o smbd/ldap.o smbd/mangle.o \ - smbd/message.o smbd/nispass.o smbd/nttrans.o \ + smbd/groupname.o smbd/ipc.o passdb/ldap.o smbd/mangle.o \ + smbd/message.o passdb/nispass.o smbd/nttrans.o \ smbd/pipes.o smbd/predict.o smbd/printing.o \ smbd/quotas.o smbd/reply.o smbd/ssl.o smbd/trans2.o smbd/uid.o diff --git a/source3/include/proto.h b/source3/include/proto.h index e3189a2d08..e310246a87 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -43,6 +43,12 @@ int process_tar(char *inbuf, char *outbuf); int clipfind(char **aret, int ret, char *tok); int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind); +/*The following definitions come from lib/access.c */ + +BOOL allow_access(char *deny_list,char *allow_list, + char *cname,char *caddr); +BOOL check_access(int sock, char *allow_list, char *deny_list); + /*The following definitions come from lib/charcnv.c */ char *unix2dos_format(char *str,BOOL overwrite); @@ -62,6 +68,7 @@ int sig_usr1( void ); void setup_logging( char *pname, BOOL interactive ); void reopen_logs( void ); void force_check_log_size( void ); +void dbgflush( void ); BOOL dbghdr( int level, char *file, char *func, int line ); /*The following definitions come from lib/fault.c */ @@ -459,6 +466,8 @@ char *smb_errstr(char *inbuf); /*The following definitions come from locking/locking.c */ +BOOL push_blocking_lock_request( char *inbuf, int length, int lock_timeout, int lock_num); +void process_blocking_lock_queue(time_t t); BOOL is_locked(int fnum,int cnum,uint32 count,uint32 offset, int lock_type); BOOL do_lock(int fnum,int cnum,uint32 count,uint32 offset,int lock_type, int *eclass,uint32 *ecode); @@ -1074,6 +1083,14 @@ BOOL pm_process( char *FileName, BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname); void pcap_printer_fn(void (*fn)(char *, char *)); +/*The following definitions come from passdb/ldap.c */ + +struct passdb_ops *ldap_initialize_password_db(void); + +/*The following definitions come from passdb/nispass.c */ + +struct passdb_ops *nisplus_initialize_password_db(void); + /*The following definitions come from passdb/pass_check.c */ void dfs_unlogin(void); @@ -1842,12 +1859,6 @@ uint32 lookup_user_rid(char *user_name, uint32 *rid); BOOL api_wkssvc_rpc(pipes_struct *p, prs_struct *data); -/*The following definitions come from smbd/access.c */ - -BOOL allow_access(char *deny_list,char *allow_list, - char *cname,char *caddr); -BOOL check_access(int sock, char *allow_list, char *deny_list); - /*The following definitions come from smbd/chgpasswd.c */ BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence, BOOL as_root); @@ -1908,10 +1919,6 @@ void map_gid_to_sid( gid_t gid, DOM_SID *psid); int get_printerdrivernumber(int snum); int reply_trans(char *inbuf,char *outbuf, int size, int bufsize); -/*The following definitions come from smbd/ldap.c */ - -struct passdb_ops *ldap_initialize_password_db(void); - /*The following definitions come from smbd/mangle.c */ BOOL is_mangled( char *s ); @@ -1929,10 +1936,6 @@ int reply_sendstrt(char *inbuf,char *outbuf, int dum_size, int dum_buffsize); int reply_sendtxt(char *inbuf,char *outbuf, int dum_size, int dum_buffsize); int reply_sendend(char *inbuf,char *outbuf, int dum_size, int dum_buffsize); -/*The following definitions come from smbd/nispass.c */ - -struct passdb_ops *nisplus_initialize_password_db(void); - /*The following definitions come from smbd/nttrans.c */ int reply_ntcreate_and_X(char *inbuf,char *outbuf,int length,int bufsize); diff --git a/source3/lib/util.c b/source3/lib/util.c index ae1a6f3282..fb2a6fa119 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2729,9 +2729,135 @@ BOOL string_sub(char *s,char *pattern,char *insert) } /********************************************************* +* Recursive routine that is called by unix_mask_match. +* Does the actual matching. This is the 'original code' +* used by the unix matcher. +*********************************************************/ +static BOOL unix_do_match(char *str, char *regexp, int case_sig) +{ + char *p; + + for( p = regexp; *p && *str; ) { + switch(*p) { + case '?': + str++; p++; + break; + + case '*': + /* Look for a character matching + the one after the '*' */ + p++; + if(!*p) + return True; /* Automatic match */ + while(*str) { + while(*str && (case_sig ? (*p != *str) : (toupper(*p)!=toupper(*str)))) + str++; + if(do_match(str,p,case_sig)) + return True; + if(!*str) + return False; + else + str++; + } + return False; + + default: + if(case_sig) { + if(*str != *p) + return False; + } else { + if(toupper(*str) != toupper(*p)) + return False; + } + str++, p++; + break; + } + } + if(!*p && !*str) + return True; + + if (!*p && str[0] == '.' && str[1] == 0) + return(True); + + if (!*str && *p == '?') + { + while (*p == '?') p++; + return(!*p); + } + + if(!*str && (*p == '*' && p[1] == '\0')) + return True; + return False; +} + + +/********************************************************* +* Routine to match a given string with a regexp - uses +* simplified regexp that takes * and ? only. Case can be +* significant or not. +* This is the 'original code' used by the unix matcher. +*********************************************************/ + +static BOOL unix_mask_match(char *str, char *regexp, int case_sig,BOOL trans2) +{ + char *p; + pstring p1, p2; + fstring ebase,eext,sbase,sext; + + BOOL matched; + + /* Make local copies of str and regexp */ + StrnCpy(p1,regexp,sizeof(pstring)-1); + StrnCpy(p2,str,sizeof(pstring)-1); + + if (!strchr(p2,'.')) { + pstrcat(p2,"."); + } + + /* Remove any *? and ** as they are meaningless */ + for(p = p1; *p; p++) + while( *p == '*' && (p[1] == '?' ||p[1] == '*')) + (void)pstrcpy( &p[1], &p[2]); + + if (strequal(p1,"*")) return(True); + + DEBUG(8,("unix_mask_match str=<%s> regexp=<%s>, case_sig = %d\n", p2, p1, case_sig)); + + if (trans2) { + fstrcpy(ebase,p1); + fstrcpy(sbase,p2); + } else { + if ((p=strrchr(p1,'.'))) { + *p = 0; + fstrcpy(ebase,p1); + fstrcpy(eext,p+1); + } else { + fstrcpy(ebase,p1); + eext[0] = 0; + } + + if (!strequal(p2,".") && !strequal(p2,"..") && (p=strrchr(p2,'.'))) { + *p = 0; + fstrcpy(sbase,p2); + fstrcpy(sext,p+1); + } else { + fstrcpy(sbase,p2); + fstrcpy(sext,""); + } + } + + matched = do_match(sbase,ebase,case_sig) && + (trans2 || do_match(sext,eext,case_sig)); + + DEBUG(8,("unix_mask_match returning %d\n", matched)); + + return matched; +} + +/********************************************************* * Recursive routine that is called by mask_match. * Does the actual matching. Returns True if matched, -* False if failed. +* False if failed. This is the 'new' NT style matcher. *********************************************************/ BOOL do_match(char *str, char *regexp, int case_sig) @@ -2810,6 +2936,7 @@ BOOL do_match(char *str, char *regexp, int case_sig) * simplified regexp that takes * and ? only. Case can be * significant or not. * The 8.3 handling was rewritten by Ums Harald <Harald.Ums@pro-sieben.de> +* This is the new 'NT style' matcher. *********************************************************/ BOOL mask_match(char *str, char *regexp, int case_sig,BOOL trans2) @@ -4206,8 +4333,12 @@ BOOL is_in_path(char *name, name_compare_entry *namelist) { if(namelist->is_wild) { - /* look for a wildcard match. */ - if (mask_match(last_component, namelist->name, case_sensitive, False)) + /* + * Look for a wildcard match. Use the old + * 'unix style' mask match, rather than the + * new NT one. + */ + if (unix_mask_match(last_component, namelist->name, case_sensitive, False)) { DEBUG(8,("is_in_path: mask match succeeded\n")); return True; diff --git a/source3/locking/locking.c b/source3/locking/locking.c index da5cdf46dd..c1c0659496 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -98,7 +98,7 @@ for fnum = %d, name = %s\n", blr->expire_time, fnum, Files[fnum].name )); Return a blocking lock success SMB. *****************************************************************************/ -void blocking_lock_reply_success(blocking_lock_record *blr) +static void blocking_lock_reply_success(blocking_lock_record *blr) { extern int chain_size; extern int chain_fnum; @@ -137,7 +137,7 @@ void blocking_lock_reply_success(blocking_lock_record *blr) Return a lock fail error. Undo all the locks we have obtained first. *****************************************************************************/ -void blocking_lock_reply_error(blocking_lock_record *blr, int eclass, int32 ecode) +static void blocking_lock_reply_error(blocking_lock_record *blr, int eclass, int32 ecode) { extern char *OutBuffer; char *outbuf = OutBuffer; @@ -177,7 +177,7 @@ void blocking_lock_reply_error(blocking_lock_record *blr, int eclass, int32 ecod Returns True if we want to be removed from the list. *****************************************************************************/ -BOOL blocking_lock_record_process(blocking_lock_record *blr) +static BOOL blocking_lock_record_process(blocking_lock_record *blr) { char *inbuf = blr->inbuf; unsigned char locktype = CVAL(inbuf,smb_vwv3); |