diff options
Diffstat (limited to 'source3')
31 files changed, 130 insertions, 97 deletions
diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 035e4f7607..395f31edcf 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -522,7 +522,7 @@ static long unoct(char *p, int ndgs) while (--ndgs) { - if (isdigit(*p)) + if (isdigit((int)*p)) value = (value << 3) | (long) (*p - '0'); p++; @@ -1517,7 +1517,7 @@ static void unfixtarname(char *tptr, char *fp, int l, BOOL first) * dos \'s in path. Kill any absolute path names. But only if first! */ - DEBUG(5, ("firstb=%lX, secondb=%lX, len=%i\n", tptr, fp, l)); + DEBUG(5, ("firstb=%lX, secondb=%lX, len=%i\n", (long)tptr, (long)fp, l)); if (first) { if (*fp == '.') { diff --git a/source3/configure b/source3/configure index 11e36f6562..b770f95376 100755 --- a/source3/configure +++ b/source3/configure @@ -1413,7 +1413,7 @@ else fi done -for ac_hdr in unistd.h utime.h grp.h sys/id.h limits.h net/if.h +for ac_hdr in unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -1453,7 +1453,7 @@ else fi done -for ac_hdr in compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h +for ac_hdr in compat.h rpcsvc/ypclnt.h sys/param.h ctype.h sys/wait.h sys/ioctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -1493,7 +1493,7 @@ else fi done -for ac_hdr in sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h +for ac_hdr in sys/filio.h string.h strings.h stdlib.h sys/socket.h sys/mode.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -3097,7 +3097,7 @@ else fi done -for ac_func in fstat strchr utime utimes getrlimit fsync execl +for ac_func in fstat strchr utime utimes getrlimit fsync execl bzero memset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:3104: checking for $ac_func" >&5 diff --git a/source3/configure.in b/source3/configure.in index af5d9200c9..c2793baf2c 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -28,9 +28,9 @@ AC_HEADER_DIRENT AC_HEADER_TIME AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h) -AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h net/if.h) -AC_CHECK_HEADERS(compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h) -AC_CHECK_HEADERS(sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h) +AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h) +AC_CHECK_HEADERS(compat.h rpcsvc/ypclnt.h sys/param.h ctype.h sys/wait.h sys/ioctl.h) +AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h sys/mode.h) AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h) AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h) AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h) @@ -144,7 +144,7 @@ fi]) AC_CHECK_FUNCS(waitpid getcwd strdup strerror chown chmod chroot) -AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl) +AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl bzero memset) AC_CHECK_FUNCS(memmove vsnprintf setsid glob strpbrk pipe crypt16 getauthuid) AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr) AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam) diff --git a/source3/include/config.h.in b/source3/include/config.h.in index ced68aa762..d3968452c3 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -127,6 +127,9 @@ /* Define if you have the bigcrypt function. */ #undef HAVE_BIGCRYPT +/* Define if you have the bzero function. */ +#undef HAVE_BZERO + /* Define if you have the chmod function. */ #undef HAVE_CHMOD @@ -190,6 +193,9 @@ /* Define if you have the memmove function. */ #undef HAVE_MEMMOVE +/* Define if you have the memset function. */ +#undef HAVE_MEMSET + /* Define if you have the mktime function. */ #undef HAVE_MKTIME @@ -286,6 +292,9 @@ /* Define if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H +/* Define if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + /* Define if you have the <ndir.h> header file. */ #undef HAVE_NDIR_H @@ -310,6 +319,9 @@ /* Define if you have the <string.h> header file. */ #undef HAVE_STRING_H +/* Define if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + /* Define if you have the <sys/dir.h> header file. */ #undef HAVE_SYS_DIR_H @@ -346,6 +358,9 @@ /* Define if you have the <sys/param.h> header file. */ #undef HAVE_SYS_PARAM_H +/* Define if you have the <rpcsvc/ypclnt.h> header file. */ +#undef HAVE_RPCSVC_YPCLNT_H + /* Define if you have the <sys/security.h> header file. */ #undef HAVE_SYS_SECURITY_H diff --git a/source3/include/includes.h b/source3/include/includes.h index 237251209a..42ec579692 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -71,6 +71,14 @@ #include <string.h> #endif +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +#ifdef HAVE_MEMORY_H +#include <memory.h> +#endif + #ifdef HAVE_MALLOC_H #include <malloc.h> #endif @@ -241,6 +249,10 @@ #include <compat.h> #endif +#ifdef HAVE_RPCSVC_YPCLNT_H +#include <rpcsvc/ypclnt.h> +#endif + #ifndef uchar #define uchar unsigned char #endif @@ -470,4 +482,8 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid); int setresgid(gid_t rgid, gid_t egid, gid_t sgid); #endif +#if !defined(HAVE_BZERO) && defined(HAVE_MEMSET) +#define bzero(a,b) memset((a),'\0',(b)) +#endif + #endif /* _INCLUDES_H */ diff --git a/source3/include/proto.h b/source3/include/proto.h index 1cab9c5e9d..74e240cfa3 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -63,8 +63,8 @@ void add_char_string(char *s); /*The following definitions come from lib/debug.c */ -int sig_usr2( void ); -int sig_usr1( void ); +void sig_usr2( int sig ); +void sig_usr1( int sig ); void setup_logging( char *pname, BOOL interactive ); void reopen_logs( void ); void force_check_log_size( void ); diff --git a/source3/include/smb.h b/source3/include/smb.h index b060134d8e..fa5d496ceb 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1274,7 +1274,7 @@ char *strdup(char *s); #endif #ifndef SIGNAL_CAST -#define SIGNAL_CAST (RETSIGTYPE (*)()) +#define SIGNAL_CAST (RETSIGTYPE (*)(int)) #endif #ifndef SELECT_CAST diff --git a/source3/lib/access.c b/source3/lib/access.c index d2286e2515..2e1eb8df55 100644 --- a/source3/lib/access.c +++ b/source3/lib/access.c @@ -106,7 +106,7 @@ static int string_match(char *tok,char *s) if (strncmp(tok, s, tok_len) == 0) return (True); } else if ((cut = strchr(tok, '/')) != 0) { /* netnumber/netmask */ - if (isdigit(s[0]) && masked_match(tok, cut, s)) + if (isdigit((int)s[0]) && masked_match(tok, cut, s)) return (True); } return (False); diff --git a/source3/lib/charset.c b/source3/lib/charset.c index 5e9481f9bb..abfa6fe787 100644 --- a/source3/lib/charset.c +++ b/source3/lib/charset.c @@ -161,7 +161,7 @@ void charset_initialise(void) } for (i=0;i<=127;i++) { - if (isalnum((char)i) || strchr("._^$~!#%&-{}()@'`",(char)i)) + if (isalnum(i) || strchr("._^$~!#%&-{}()@'`",(char)i)) add_dos_char(i,False,0,False); } @@ -172,8 +172,8 @@ void charset_initialise(void) /* Some systems have buggy isupper/islower for characters above 127. Best not to rely on them. */ if(i < 128) { - if (isupper(c)) lower_char_map[i] = tolower(c); - if (islower(c)) upper_char_map[i] = toupper(c); + if (isupper((int)c)) lower_char_map[i] = tolower(c); + if (islower((int)c)) upper_char_map[i] = toupper(c); } } } diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 24f508c0b4..1303d0433b 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -112,7 +112,7 @@ static int format_pos = 0; * catch a sigusr2 - decrease the debug log level. * ************************************************************************** ** */ -int sig_usr2( void ) +void sig_usr2( int sig ) { BlockSignals( True, SIGUSR2 ); @@ -125,7 +125,6 @@ int sig_usr2( void ) BlockSignals( False, SIGUSR2 ); CatchSignal( SIGUSR2, SIGNAL_CAST sig_usr2 ); - return( 0 ); } /* sig_usr2 */ #endif /* SIGUSR2 */ @@ -134,7 +133,7 @@ int sig_usr2( void ) * catch a sigusr1 - increase the debug log level. * ************************************************************************** ** */ -int sig_usr1( void ) +void sig_usr1( int sig ) { BlockSignals( True, SIGUSR1 ); @@ -148,7 +147,6 @@ int sig_usr1( void ) BlockSignals( False, SIGUSR1 ); CatchSignal( SIGUSR1, SIGNAL_CAST sig_usr1 ); - return( 0 ); } /* sig_usr1 */ #endif /* SIGUSR1 */ diff --git a/source3/lib/kanji.c b/source3/lib/kanji.c index 523eb178e2..4ca5984d80 100644 --- a/source3/lib/kanji.c +++ b/source3/lib/kanji.c @@ -856,7 +856,7 @@ static char *hex_to_sj(char *from, BOOL overwrite) sp = (char *) from; dp = cvtbuf; while (*sp) { - if (*sp == hex_tag && isxdigit (sp[1]) && isxdigit (sp[2])) { + if (*sp == hex_tag && isxdigit((int)sp[1]) && isxdigit((int)sp[2])) { *dp++ = (hex2bin (sp[1])<<4) | (hex2bin (sp[2])); sp += 3; } else @@ -924,7 +924,7 @@ static char *cap_to_sj(char *from, BOOL overwrite) * we only do the reverse (that's why the strchr is used rather than * isxdigit. Based on fix from ado@elsie.nci.nih.gov (Arthur David Olson). */ - if (*sp == hex_tag && (strchr ("89abcdefABCDEF", sp[1]) != NULL) && isxdigit (sp[2])) { + if (*sp == hex_tag && (strchr ("89abcdefABCDEF", sp[1]) != NULL) && isxdigit((int)sp[2])) { *dp++ = (hex2bin (sp[1])<<4) | (hex2bin (sp[2])); sp += 3; } else diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c index 0388b3f1bd..fcb14378a0 100644 --- a/source3/lib/smbrun.c +++ b/source3/lib/smbrun.c @@ -85,7 +85,6 @@ if shared is not set then open the file with O_EXCL set ****************************************************************************/ int smbrun(char *cmd,char *outfile,BOOL shared) { - extern struct current_user current_user; int fd,pid; int uid = current_user.uid; int gid = current_user.gid; diff --git a/source3/lib/util.c b/source3/lib/util.c index 863e2d94af..c1eb7cc879 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -3636,7 +3636,7 @@ uint32 interpret_addr(char *str) if (strcmp(str,"255.255.255.255") == 0) return(0xFFFFFFFF); for (i=0; pure_address && str[i]; i++) - if (!(isdigit(str[i]) || str[i] == '.')) + if (!(isdigit((int)str[i]) || str[i] == '.')) pure_address = False; /* if it's in the form of an IP address then get the lib to interpret it */ @@ -4608,7 +4608,7 @@ BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type) (lock.l_pid != 0) && (lock.l_pid != getpid())) { - DEBUG(3,("fd %d is locked by pid %d\n",fd,lock.l_pid)); + DEBUG(3,("fd %d is locked by pid %d\n",fd,(int)lock.l_pid)); return(True); } diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 344806083a..8b0d68ce6a 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -72,7 +72,7 @@ static void _interpret_node_status(char *p, char *master,char *rname) } for (i = strlen( qname) ; --i >= 0 ; ) { - if (!isprint(qname[i])) qname[i] = '.'; + if (!isprint((int)qname[i])) qname[i] = '.'; } DEBUG(1,("\t%-15s <%02x> - %s\n",qname,type,flags)); p+=2; @@ -439,7 +439,7 @@ BOOL resolve_name(char *name, struct in_addr *return_ip) } for (i=0; pure_address && name[i]; i++) - if (!(isdigit(name[i]) || name[i] == '.')) + if (!(isdigit((int)name[i]) || name[i] == '.')) pure_address = False; /* if it's in the form of an IP address then get the lib to interpret it */ diff --git a/source3/locking/shmem.c b/source3/locking/shmem.c index dd97d5c76c..be8e22108a 100644 --- a/source3/locking/shmem.c +++ b/source3/locking/shmem.c @@ -340,7 +340,7 @@ static BOOL smb_shm_register_process(char *processreg_file, pid_t pid, BOOL *oth { /* erase old pid */ DEBUG(5,("smb_shm_register_process : erasing stale record for pid %d (seek_back = %d)\n", - other_pid, seek_back)); + (int)other_pid, seek_back)); other_pid = (pid_t)0; erased_slot = lseek(smb_shm_processes_fd, seek_back, SEEK_CUR); write(smb_shm_processes_fd, &other_pid, sizeof(other_pid)); @@ -362,7 +362,8 @@ static BOOL smb_shm_register_process(char *processreg_file, pid_t pid, BOOL *oth if(free_slot < 0) free_slot = lseek(smb_shm_processes_fd, 0, SEEK_END); - DEBUG(5,("smb_shm_register_process : writing record for pid %d at offset %d\n",pid,free_slot)); + DEBUG(5,("smb_shm_register_process : writing record for pid %d at offset %d\n", + (int)pid,free_slot)); lseek(smb_shm_processes_fd, free_slot, SEEK_SET); if(write(smb_shm_processes_fd, &pid, sizeof(pid)) < 0) { @@ -395,12 +396,12 @@ static BOOL smb_shm_unregister_process(char *processreg_file, pid_t pid) while ((nb_read = read(smb_shm_processes_fd, &other_pid, sizeof(other_pid))) > 0) { - DEBUG(5,("smb_shm_unregister_process : read record for pid %d\n",other_pid)); + DEBUG(5,("smb_shm_unregister_process : read record for pid %d\n",(int)other_pid)); if(other_pid == pid) { /* erase pid */ DEBUG(5,("smb_shm_unregister_process : erasing record for pid %d (seek_val = %d)\n", - other_pid, seek_back)); + (int)other_pid, seek_back)); other_pid = (pid_t)0; erased_slot = lseek(smb_shm_processes_fd, seek_back, SEEK_CUR); if(write(smb_shm_processes_fd, &other_pid, sizeof(other_pid)) < 0) @@ -423,7 +424,8 @@ static BOOL smb_shm_unregister_process(char *processreg_file, pid_t pid) if(!found) { - DEBUG(0,("ERROR smb_shm_unregister_process : couldn't find pid %d in file %s\n",pid,processreg_file)); + DEBUG(0,("ERROR smb_shm_unregister_process : couldn't find pid %d in file %s\n", + (int)pid,processreg_file)); close(smb_shm_processes_fd); return False; } @@ -540,7 +542,8 @@ static BOOL smb_shm_close( void ) } smb_shm_global_lock(); - DEBUG(5,("calling smb_shm_unregister_process(%s, %d)\n", smb_shm_processreg_name, getpid())); + DEBUG(5,("calling smb_shm_unregister_process(%s, %d)\n", + smb_shm_processreg_name, (int)getpid())); smb_shm_unregister_process(smb_shm_processreg_name, getpid()); smb_shm_global_unlock(); diff --git a/source3/locking/shmem_sysv.c b/source3/locking/shmem_sysv.c index b8b9c2cb45..192ed32344 100644 --- a/source3/locking/shmem_sysv.c +++ b/source3/locking/shmem_sysv.c @@ -564,8 +564,9 @@ struct shmem_ops *sysv_shm_open(int ronly) } if (sem_id == -1) { - DEBUG(0,("Can't create or use semaphore %s\n", + DEBUG(0,("Can't create or use semaphore [1]. Error was %s\n", strerror(errno))); + return NULL; } if (sem_id != -1) { @@ -574,6 +575,7 @@ struct shmem_ops *sysv_shm_open(int ronly) if (semctl(sem_id, i, SETVAL, su) != 0) { DEBUG(1,("Failed to init semaphore %d. Error was %s\n", i, strerror(errno))); + return NULL; } } } @@ -582,7 +584,7 @@ struct shmem_ops *sysv_shm_open(int ronly) sem_id = semget(SEMAPHORE_KEY, 0, 0); } if (sem_id == -1) { - DEBUG(0,("Can't create or use semaphore.Error was %s\n", + DEBUG(0,("Can't create or use semaphore [2]. Error was %s\n", strerror(errno))); return NULL; } @@ -609,6 +611,7 @@ struct shmem_ops *sysv_shm_open(int ronly) if (semctl(sem_id, 0, SETVAL, su) != 0) { DEBUG(0,("ERROR: Failed to clear global lock. Error was %s\n", strerror(errno))); + return NULL; } } @@ -616,6 +619,7 @@ struct shmem_ops *sysv_shm_open(int ronly) if (semctl(sem_id, 0, IPC_SET, su) != 0) { DEBUG(0,("ERROR shmctl : can't IPC_SET. Error was %s\n", strerror(errno))); + return NULL; } } @@ -632,6 +636,8 @@ struct shmem_ops *sysv_shm_open(int ronly) if (semctl(sem_id, i, SETVAL, su) != 0) { DEBUG(0,("ERROR: Failed to clear IPC lock %d. Error was %s\n", i, strerror(errno))); + global_unlock(); + return NULL; } } } @@ -679,6 +685,8 @@ struct shmem_ops *sysv_shm_open(int ronly) mapping processes */ if (shmctl(shm_id, IPC_STAT, &shm_ds) != 0) { DEBUG(0,("ERROR shmctl : can't IPC_STAT. Error was %s\n", strerror(errno))); + global_unlock(); + return NULL; } if (!read_only) { diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c index 89be2b0ce0..9926045d82 100644 --- a/source3/nmbd/asyncdns.c +++ b/source3/nmbd/asyncdns.c @@ -110,11 +110,9 @@ static void asyncdns_process(void) WINS db that our parent is going to write. **************************************************************************** */ -static int sig_term(void) +static void sig_term(int sig) { _exit(0); - /* Keep compiler happy.. */ - return 0; } /*************************************************************************** diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 24f4951612..9eae3b0e98 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -61,7 +61,7 @@ extern struct in_addr ipzero; /**************************************************************************** ** catch a sigterm **************************************************************************** */ -static int sig_term(void) +static void sig_term(int sig) { BlockSignals(True,SIGTERM); @@ -81,14 +81,12 @@ static int sig_term(void) exit(0); - /* Keep compiler happy.. */ - return 0; } /* sig_term */ /**************************************************************************** ** catch a sighup **************************************************************************** */ -static int sig_hup(void) +static void sig_hup(int sig) { BlockSignals( True, SIGHUP ); @@ -103,13 +101,12 @@ static int sig_hup(void) BlockSignals(False,SIGHUP); - return(0); } /* sig_hup */ /**************************************************************************** ** catch a sigpipe **************************************************************************** */ -static int sig_pipe(void) +static void sig_pipe(int sig) { BlockSignals( True, SIGPIPE ); @@ -117,7 +114,6 @@ static int sig_pipe(void) if ( !is_daemon ) exit(1); BlockSignals( False, SIGPIPE ); - return(0); } /* sig_pipe */ #if DUMP_CORE @@ -147,7 +143,7 @@ static BOOL dump_core(void) rlp.rlim_cur = MAX( 4*1024*1024, rlp.rlim_cur ); setrlimit( RLIMIT_CORE, &rlp ); getrlimit( RLIMIT_CORE, &rlp ); - DEBUG( 3, ( "Core limits now %d %d\n", rlp.rlim_cur, rlp.rlim_max ) ); + DEBUG( 3, ( "Core limits now %d %d\n", (int)rlp.rlim_cur, (int)rlp.rlim_max ) ); } #endif #endif diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 0ca71dda94..0d806fccf7 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -113,7 +113,7 @@ struct smb_passwd *iterate_getsmbpwuid(uid_t smb_userid) struct smb_passwd *pwd = NULL; void *fp = NULL; - DEBUG(10, ("iterate_getsmbpwuid: search by smb_userid: %x\n", smb_userid)); + DEBUG(10, ("iterate_getsmbpwuid: search by smb_userid: %x\n", (int)smb_userid)); /* Open the smb password database - not for update. */ fp = startsmbpwent(False); @@ -129,7 +129,7 @@ struct smb_passwd *iterate_getsmbpwuid(uid_t smb_userid) if (pwd != NULL) { - DEBUG(10, ("iterate_getsmbpwuid: found by smb_userid: %x\n", smb_userid)); + DEBUG(10, ("iterate_getsmbpwuid: found by smb_userid: %x\n", (int)smb_userid)); } endsmbpwent(fp); @@ -370,7 +370,7 @@ struct sam_passwd *iterate_getsam21pwuid(uid_t uid) struct sam_passwd *pwd = NULL; void *fp = NULL; - DEBUG(10, ("iterate_getsam21pwuid: search by uid: %x\n", uid)); + DEBUG(10, ("iterate_getsam21pwuid: search by uid: %x\n", (int)uid)); /* Open the smb password file - not for update. */ fp = startsmbpwent(False); @@ -386,7 +386,7 @@ struct sam_passwd *iterate_getsam21pwuid(uid_t uid) if (pwd != NULL) { - DEBUG(10, ("iterate_getsam21pwuid: found by smb_userid: %x\n", uid)); + DEBUG(10, ("iterate_getsam21pwuid: found by smb_userid: %x\n", (int)uid)); } endsmbpwent(fp); @@ -599,7 +599,7 @@ static time_t get_time_from_string(char *p) for (i = 0; i < 8; i++) { - if (p[i] == '\0' || !isxdigit(p[i])) + if (p[i] == '\0' || !isxdigit((int)p[i])) break; } if (i == 8) diff --git a/source3/passdb/smbpassfile.c b/source3/passdb/smbpassfile.c index efbbbd78bf..49cf194cc6 100644 --- a/source3/passdb/smbpassfile.c +++ b/source3/passdb/smbpassfile.c @@ -268,7 +268,7 @@ BOOL get_trust_account_password( unsigned char *ret_pwd, time_t *pass_last_set_t p = &linebuf[37]; for(i = 0; i < 8; i++) { - if(p[i] == '\0' || !isxdigit(p[i])) { + if(p[i] == '\0' || !isxdigit((int)p[i])) { DEBUG(0,("get_trust_account_password: Malformed trust password file (no timestamp).\n")); #ifdef DEBUG_PASSWORD DEBUG(100,("get_trust_account_password: line = |%s|\n", linebuf)); diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 00ff869278..2c7197f9db 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -235,7 +235,7 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first) return(False); /* the Job and Total columns must be integer */ - if (!isdigit(*tok[JOBTOK]) || !isdigit(*tok[TOTALTOK])) return(False); + if (!isdigit((int)*tok[JOBTOK]) || !isdigit((int)*tok[TOTALTOK])) return(False); /* if the fname contains a space then use STDIN */ if (strchr(tok[FILETOK],' ')) @@ -405,7 +405,7 @@ A long spool-path will just waste significant chars of the file name. return(False); /* the Job and Total columns must be integer */ - if (!isdigit(*tok[LPRNG_JOBTOK]) || !isdigit(*tok[LPRNG_TOTALTOK])) return(False); + if (!isdigit((int)*tok[LPRNG_JOBTOK]) || !isdigit((int)*tok[LPRNG_TOTALTOK])) return(False); /* if the fname contains a space then use STDIN */ /* I do not understand how this would be possible. Magnus. */ @@ -479,7 +479,7 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first) if ((count == 7) && ((strcmp(tok[0],"QUEUED") == 0) || (strcmp(tok[0],"HELD") == 0))) { /* the 2nd and 5th columns must be integer */ - if (!isdigit(*tok[1]) || !isdigit(*tok[4])) return(False); + if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[4])) return(False); buf->size = atoi(tok[4]) * 1024; /* if the fname contains a space then use STDIN */ if (strchr(tok[2],' ')) @@ -513,7 +513,7 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first) else { /* the 4th and 9th columns must be integer */ - if (!isdigit(*tok[3]) || !isdigit(*tok[8])) return(False); + if (!isdigit((int)*tok[3]) || !isdigit((int)*tok[8])) return(False); buf->size = atoi(tok[8]) * 1024; /* if the fname contains a space then use STDIN */ if (strchr(tok[4],' ')) @@ -590,7 +590,7 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first) if (count < 2) return(False); /* the 2nd column must be integer */ - if (!isdigit(*tok[1])) return(False); + if (!isdigit((int)*tok[1])) return(False); /* if the fname contains a space then use STDIN */ if (strchr(tok[0],' ')) @@ -628,7 +628,7 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first) /* first token must be printer name (cannot check ?) */ /* the 2nd, 5th & 7th column must be integer */ - if (!isdigit(*tok[1]) || !isdigit(*tok[4]) || !isdigit(*tok[6])) return(False); + if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[4]) || !isdigit((int)*tok[6])) return(False); jobid = atoi(tok[1]); StrnCpy(jobuser,tok[2],sizeof(buf->user)-1); jobprio = atoi(tok[4]); @@ -678,8 +678,8 @@ static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first) return(False); /* the 2nd and 4th, 6th columns must be integer */ - if (!isdigit(*tok[1]) || !isdigit(*tok[3])) return(False); - if (!isdigit(*tok[5])) return(False); + if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[3])) return(False); + if (!isdigit((int)*tok[5])) return(False); /* if the user contains a ! then trim the first part of it */ if ((p=strchr(tok[2],'!'))) @@ -742,7 +742,7 @@ static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first) return(False); /* the 3rd and 5th columns must be integer */ - if (!isdigit(*tok[2]) || !isdigit(*tok[4])) return(False); + if (!isdigit((int)*tok[2]) || !isdigit((int)*tok[4])) return(False); /* only take the last part of the filename */ { @@ -797,11 +797,11 @@ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first) return(False); /* the first must be "active" or begin with an integer */ - if (strcmp(tok[0],"active") && !isdigit(tok[0][0])) + if (strcmp(tok[0],"active") && !isdigit((int)tok[0][0])) return(False); /* the 5th and 8th must be integer */ - if (!isdigit(*tok[4]) || !isdigit(*tok[7])) + if (!isdigit((int)*tok[4]) || !isdigit((int)*tok[7])) return(False); /* if the fname contains a space then use STDIN */ @@ -865,20 +865,20 @@ static BOOL parse_lpq_softq(char *line,print_queue_struct *buf,BOOL first) return(False); /* the 1st and 7th columns must be integer */ - if (!isdigit(*tok[0]) || !isdigit(*tok[6])) return(False); + if (!isdigit((int)*tok[0]) || !isdigit((int)*tok[6])) return(False); /* if the 2nd column is either '>' or 'H' then the 7th and 8th must be * integer, else it's the 6th and 7th that must be */ if (*tok[1] == 'H' || *tok[1] == '>') { - if (!isdigit(*tok[7])) + if (!isdigit((int)*tok[7])) return(False); buf->status = *tok[1] == '>' ? LPQ_PRINTING : LPQ_PAUSED; count = 1; } else { - if (!isdigit(*tok[5])) + if (!isdigit((int)*tok[5])) return(False); buf->status = LPQ_QUEUED; count = 0; diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index 6594c5f48c..bd7d28b11f 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -342,7 +342,7 @@ BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence, BOOL if(as_root) become_root(False); - DEBUG(3,("Dochild for user %s (uid=%d,gid=%d)\n",name,getuid(),getgid())); + DEBUG(3,("Dochild for user %s (uid=%d,gid=%d)\n",name,(int)getuid(),(int)getgid())); chstat = dochild(master, slavedev, name, passwordprogram, as_root); if(as_root) @@ -404,7 +404,7 @@ BOOL chgpasswd(char *name,char *oldpass,char *newpass, BOOL as_root) len = strlen(oldpass); for(i = 0; i < len; i++) { - if(iscntrl(oldpass[i])) { + if(iscntrl((int)oldpass[i])) { DEBUG(0,("chat_with_program: oldpass contains control characters (disallowed).\n")); return False; } @@ -412,7 +412,7 @@ BOOL chgpasswd(char *name,char *oldpass,char *newpass, BOOL as_root) len = strlen(newpass); for(i = 0; i < len; i++) { - if(iscntrl(newpass[i])) { + if(iscntrl((int)newpass[i])) { DEBUG(0,("chat_with_program: newpass contains control characters (disallowed).\n")); return False; } diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index a72b442735..63495f0479 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -274,7 +274,7 @@ static int get_counter(char** p) { int i, n; if (!p || !(*p)) return(1); - if (!isdigit(**p)) return 1; + if (!isdigit((int)**p)) return 1; for (n = 0;;) { i = **p; if (isdigit(i)) @@ -1969,7 +1969,7 @@ static BOOL api_PrintJobInfo(connection_struct *conn,uint16 vuid,char *param,cha break; case 0xb: /* change print job name, data gives the name */ /* jobid, snum should be zero */ - if (isalpha(*s)) + if (isalpha((int)*s)) { pstring name; int l = 0; diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index bff61b6736..94ecbfea49 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -452,6 +452,7 @@ int reply_ntcreate_and_X(connection_struct *conn, int ret = nt_open_pipe(fname, conn, inbuf, outbuf, &fnum); if(ret != 0) return ret; + fsp = &Files[fnum]; smb_action = FILE_WAS_OPENED; } else { @@ -667,7 +668,7 @@ int reply_ntcreate_and_X(connection_struct *conn, DEBUG(5,("reply_ntcreate_and_X: open fnum = %d, name = %s\n", - fnum, fsp?fsp->fsp_name:"NULL")); + fnum, fsp->fsp_name)); return chain_reply(inbuf,outbuf,length,bufsize); } diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 118251ffd6..121ebb7f00 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -829,7 +829,7 @@ static BOOL check_user_equiv(char *user, char *remote, char *equiv_file) { BOOL host_ok = False; -#ifdef HAVE_NETGROUP +#if defined(HAVE_NETGROUP) && defined(HAVE_YP_GET_DEFAULT_DOMAIN) if (is_group) { static char *mydomain = NULL; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 66d1dd2839..626d2e9617 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -327,7 +327,6 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt pstrcpy(smb_buf(outbuf),devicename); } else { char *fsname = FSTYPE_STRING; - char *p; set_message(outbuf,3,3,True); @@ -1565,7 +1564,7 @@ int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, DEBUG( 2, ( "new file %s\n", fname ) ); DEBUG( 3, ( "mknew %s fd=%d fnum=%d dmode=%d umode=%o\n", - fname, fsp->fd_ptr->fd, fnum, createmode, unixmode ) ); + fname, fsp->fd_ptr->fd, fnum, createmode, (int)unixmode ) ); return(outsize); } @@ -1642,7 +1641,7 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, DEBUG( 2, ( "created temp file %s\n", fname2 ) ); DEBUG( 3, ( "ctemp %s fd=%d fnum=%d dmode=%d umode=%o\n", - fname2, fsp->fd_ptr->fd, fnum, createmode, unixmode ) ); + fname2, fsp->fd_ptr->fd, fnum, createmode, (int)unixmode ) ); return(outsize); } @@ -2640,7 +2639,7 @@ int reply_printopen(connection_struct *conn, pstrcpy(s,smb_buf(inbuf)+1); p = s; while (*p) { - if (!(isalnum(*p) || strchr("._-",*p))) + if (!(isalnum((int)*p) || strchr("._-",*p))) *p = 'X'; p++; } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 9c7bafd9dd..ba93ceaa16 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -2436,7 +2436,7 @@ int error_packet(char *inbuf,char *outbuf,int error_class,uint32 error_code,int /**************************************************************************** this is called when the client exits abruptly **************************************************************************/ -static int sig_pipe(void) +static void sig_pipe(int sig) { struct cli_state *cli; BlockSignals(True,SIGPIPE); @@ -2445,11 +2445,10 @@ static int sig_pipe(void) DEBUG(3,("lost connection to password server\n")); cli_shutdown(cli); BlockSignals(False,SIGPIPE); - return 0; + return; } exit_server("Got sigpipe\n"); - return(0); } /**************************************************************************** @@ -2756,7 +2755,7 @@ address %x. Error was %s\n", htonl(INADDR_LOOPBACK), strerror(errno))); oplock_port = ntohs(sock_name.sin_port); DEBUG(3,("open_oplock ipc: pid = %d, oplock_port = %u\n", - getpid(), oplock_port)); + (int)getpid(), oplock_port)); return True; } @@ -3420,7 +3419,7 @@ this prevents zombie child processes ****************************************************************************/ static BOOL reload_after_sighup = False; -static int sig_hup(void) +static void sig_hup(int sig) { BlockSignals(True,SIGHUP); DEBUG(0,("Got SIGHUP\n")); @@ -3433,7 +3432,6 @@ static int sig_hup(void) reload_after_sighup = True; BlockSignals(False,SIGHUP); - return(0); } /**************************************************************************** @@ -4377,7 +4375,7 @@ static BOOL dump_core(void) rlp.rlim_cur = MAX(4*1024*1024,rlp.rlim_cur); setrlimit(RLIMIT_CORE, &rlp); getrlimit(RLIMIT_CORE, &rlp); - DEBUG(3,("Core limits now %d %d\n",rlp.rlim_cur,rlp.rlim_max)); + DEBUG(3,("Core limits now %d %d\n",(int)rlp.rlim_cur,(int)rlp.rlim_max)); } #endif #endif @@ -5312,14 +5310,14 @@ static void usage(char *pname) rlp.rlim_cur = (MAX_OPEN_FILES+10>rlp.rlim_max)? rlp.rlim_max:MAX_OPEN_FILES+10; setrlimit(RLIMIT_NOFILE, &rlp); getrlimit(RLIMIT_NOFILE, &rlp); - DEBUG(3,("Maximum number of open files per session is %d\n",rlp.rlim_cur)); + DEBUG(3,("Maximum number of open files per session is %d\n",(int)rlp.rlim_cur)); } #endif #endif DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n", - getuid(),getgid(),geteuid(),getegid())); + (int)getuid(),(int)getgid(),(int)geteuid(),(int)getegid())); if (sizeof(uint16) < 2 || sizeof(uint32) < 4) { diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 07f0316c22..992d8cd616 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -940,7 +940,7 @@ resume_key = %d resume name = %s continue=%d level = %d\n", */ int current_pos, start_pos; - char *dname; + char *dname = NULL; void *dirptr = conn->dirptr; start_pos = TellDir(dirptr); for(current_pos = start_pos; current_pos >= 0; current_pos--) @@ -957,7 +957,8 @@ resume_key = %d resume name = %s continue=%d level = %d\n", * here. */ - name_map_mangle( dname, False, SNUM(conn)); + if(dname != NULL) + name_map_mangle( dname, False, SNUM(conn)); if(dname && strcsequal( resume_name, dname)) { @@ -984,9 +985,10 @@ resume_key = %d resume name = %s continue=%d level = %d\n", * here. */ - name_map_mangle( dname, False, SNUM(conn)); + if(dname != NULL) + name_map_mangle( dname, False, SNUM(conn)); - if(strcsequal( resume_name, dname)) + if(dname && strcsequal( resume_name, dname)) { SeekDir(dirptr, current_pos+1); DEBUG(7,("call_trans2findnext: got match at pos %d\n", current_pos+1 )); diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c index 1276eeaaac..08a3952b3a 100644 --- a/source3/smbd/uid.c +++ b/source3/smbd/uid.c @@ -96,7 +96,7 @@ static BOOL become_uid(int uid) #endif { DEBUG(0,("Couldn't set uid %d currently set to (%d,%d)\n", - uid,getuid(), geteuid())); + uid,(int)getuid(), (int)geteuid())); if (uid > 32000) { DEBUG(0,("Looks like your OS doesn't like high uid values - try using a different account\n")); } @@ -133,7 +133,7 @@ static BOOL become_gid(int gid) #endif { DEBUG(0,("Couldn't set gid %d currently set to (%d,%d)\n", - gid,getgid(),getegid())); + gid,(int)getgid(),(int)getegid())); if (gid > 32000) { DEBUG(0,("Looks like your OS doesn't like high gid values - try using a different account\n")); } @@ -290,7 +290,7 @@ BOOL become_user(connection_struct *conn, uint16 vuid) current_user.vuid = vuid; DEBUG(5,("become_user uid=(%d,%d) gid=(%d,%d)\n", - getuid(),geteuid(),getgid(),getegid())); + (int)getuid(),(int)geteuid(),(int)getgid(),(int)getegid())); return(True); } @@ -340,7 +340,7 @@ BOOL unbecome_user(void ) DEBUG( 0, ( "chdir(%s) failed in unbecome_user\n", OriginalDir ) ); DEBUG(5,("unbecome_user now uid=(%d,%d) gid=(%d,%d)\n", - getuid(),geteuid(),getgid(),getegid())); + (int)getuid(),(int)geteuid(),(int)getgid(),(int)getegid())); current_user.conn = NULL; current_user.vuid = UID_FIELD_INVALID; diff --git a/source3/utils/make_smbcodepage.c b/source3/utils/make_smbcodepage.c index b0970a7d25..86c9df3a18 100644 --- a/source3/utils/make_smbcodepage.c +++ b/source3/utils/make_smbcodepage.c @@ -127,7 +127,7 @@ BOOL parse_byte(char *buf, unsigned char *bp) BOOL parse_bool(char *buf, unsigned char *bp) { - if(isdigit(*buf)) + if(isdigit((int)*buf)) { char *endptr = NULL; diff --git a/source3/web/cgi.c b/source3/web/cgi.c index 1a9d34d004..20337e0459 100644 --- a/source3/web/cgi.c +++ b/source3/web/cgi.c @@ -499,7 +499,7 @@ static void cgi_download(char *file) /* sanitise the filename */ for (i=0;file[i];i++) { - if (!isalnum(file[i]) && !strchr("/.-_", file[i])) { + if (!isalnum((int)file[i]) && !strchr("/.-_", file[i])) { cgi_setup_error("404 File Not Found","", "Illegal character in filename"); } |