diff options
-rw-r--r-- | lib/util/util.h | 2 | ||||
-rw-r--r-- | source3/Makefile.in | 30 | ||||
-rw-r--r-- | source3/client/client.c | 6 | ||||
-rw-r--r-- | source3/client/smbspool.c | 2 | ||||
-rw-r--r-- | source3/groupdb/mapping_ldb.c | 4 | ||||
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/lib/smbconf/smbconf_txt.c | 2 | ||||
-rw-r--r-- | source3/lib/util.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd.c | 4 | ||||
-rw-r--r-- | source3/nmbd/nmbd_processlogon.c | 2 | ||||
-rw-r--r-- | source3/param/loadparm.c | 2 | ||||
-rw-r--r-- | source3/registry/reg_perfcount.c | 2 | ||||
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_eventlog_lib.c | 2 | ||||
-rw-r--r-- | source3/smbd/server.c | 4 | ||||
-rw-r--r-- | source3/torture/vfstest.c | 2 | ||||
-rw-r--r-- | source3/utils/testparm.c | 4 | ||||
-rw-r--r-- | source3/web/cgi.c | 2 | ||||
-rw-r--r-- | source3/web/swat.c | 4 | ||||
-rw-r--r-- | source3/winbindd/idmap_tdb.c | 2 | ||||
-rw-r--r-- | source3/winbindd/winbindd.c | 4 | ||||
-rw-r--r-- | source4/smbd/pidfile.c | 2 |
22 files changed, 49 insertions, 41 deletions
diff --git a/lib/util/util.h b/lib/util/util.h index e4a5a0c662..47adf067f0 100644 --- a/lib/util/util.h +++ b/lib/util/util.h @@ -574,7 +574,7 @@ _PUBLIC_ bool same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask /** Check if a process exists. Does this work on all unixes? **/ -_PUBLIC_ bool process_exists(pid_t pid); +_PUBLIC_ bool process_exists_by_pid(pid_t pid); /** Simple routine to do POSIX file locking. Cruft in NFS and 64->32 bit mapping diff --git a/source3/Makefile.in b/source3/Makefile.in index 44f06a6cae..1b460f414e 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -315,29 +315,35 @@ LIBSAMBAUTIL_OBJ = @LIBTALLOC_STATIC@ \ $(SOCKET_WRAPPER_OBJ) \ $(NSS_WRAPPER_OBJ) -LIB_OBJ = $(LIBSAMBAUTIL_OBJ) \ +UTIL_OBJ = ../lib/util/rbtree.o ../lib/util/signal.o ../lib/util/time.o \ + ../lib/util/xfile.o ../lib/util/util_strlist.o \ + ../lib/util/util_file.o ../lib/util/data_blob.o \ + ../lib/util/util.o ../lib/util/fsusage.o + +CRYPTO_OBJ = ../lib/crypto/crc32.o ../lib/crypto/md5.o \ + ../lib/crypto/hmacmd5.o ../lib/crypto/arcfour.o \ + ../lib/crypto/md4.o + +LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) \ lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \ lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \ - lib/interfaces.o ../lib/util/rbtree.o lib/memcache.o \ + lib/interfaces.o lib/memcache.o \ lib/util_transfer_file.o lib/async_req.o \ lib/async_sock.o \ $(TDB_LIB_OBJ) \ $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ - lib/interface.o ../lib/crypto/md4.o \ - lib/pidfile.o \ - ../lib/util/signal.o lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \ - ../lib/util/time.o \ + lib/interface.o lib/pidfile.o \ + lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \ lib/ufc.o lib/genrand.o lib/username.o \ lib/util_pw.o lib/access.o lib/smbrun.o \ - lib/bitmap.o ../lib/crypto/crc32.o lib/dprintf.o $(UTIL_REG_OBJ) \ - ../lib/util/xfile.o ../lib/util/util_strlist.o lib/wins_srv.o \ + lib/bitmap.o lib/dprintf.o $(UTIL_REG_OBJ) \ + lib/wins_srv.o \ lib/util_str.o lib/clobber.o lib/util_sid.o lib/util_uuid.o \ - lib/util_unistr.o ../lib/util/util_file.o lib/util_file.o ../lib/util/data_blob.o \ - lib/util.o ../lib/util/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o \ - lib/substitute.o ../lib/util/fsusage.o lib/dbwrap_util.o \ + lib/util_unistr.o lib/util_file.o \ + lib/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o \ + lib/substitute.o lib/dbwrap_util.o \ lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \ lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \ - ../lib/crypto/md5.o ../lib/crypto/hmacmd5.o ../lib/crypto/arcfour.o \ lib/iconv.o lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \ lib/adt_tree.o lib/gencache.o \ lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \ diff --git a/source3/client/client.c b/source3/client/client.c index 0fbf56fedb..26badc4051 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -1203,7 +1203,7 @@ static void do_mget(file_info *finfo, const char *dir) strlower_m(finfo->name); } - if (!directory_exist(finfo->name,NULL) && + if (!directory_exist(finfo->name) && mkdir(finfo->name,0777) != 0) { d_printf("failed to create directory %s\n",finfo->name); client_set_cur_dir(saved_curdir); @@ -1752,7 +1752,7 @@ static int cmd_put(void) SMB_STRUCT_STAT st; /* allow '-' to represent stdin jdblair, 24.jun.98 */ - if (!file_exist(lname,&st) && + if (!file_exist_stat(lname,&st) && (strcmp(lname,"-"))) { d_printf("%s does not exist\n",lname); return 1; @@ -3566,7 +3566,7 @@ static int cmd_reput(void) return 1; } - if (!file_exist(local_name, &st)) { + if (!file_exist_stat(local_name, &st)) { d_printf("%s does not exist\n", local_name); return 1; } diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c index 4a173714fe..1910ccd4fe 100644 --- a/source3/client/smbspool.c +++ b/source3/client/smbspool.c @@ -482,7 +482,7 @@ smb_connect(const char *workgroup, /* I - Workgroup */ /* * Get the names and addresses of the client and server... */ - myname = get_myname(talloc_tos()); + myname = talloc_get_myname(talloc_tos()); if (!myname) { return NULL; } diff --git a/source3/groupdb/mapping_ldb.c b/source3/groupdb/mapping_ldb.c index 7ce879fb6e..1a6b99fa18 100644 --- a/source3/groupdb/mapping_ldb.c +++ b/source3/groupdb/mapping_ldb.c @@ -63,7 +63,7 @@ static bool init_group_mapping(void) /* Ensure this db is created read/write for root only. */ ldb_set_create_perms(ldb, 0600); - existed = file_exist(db_path, NULL); + existed = file_exist(db_path); if (lp_parm_bool(-1, "groupmap", "nosync", False)) { flags |= LDB_FLG_NOSYNC; @@ -99,7 +99,7 @@ static bool init_group_mapping(void) /* possibly upgrade */ tdb_path = state_path("group_mapping.tdb"); - if (file_exist(tdb_path, NULL) && !mapping_upgrade(tdb_path)) { + if (file_exist(tdb_path) && !mapping_upgrade(tdb_path)) { unlink(state_path("group_mapping.ldb")); goto failed; } diff --git a/source3/include/proto.h b/source3/include/proto.h index c03c34bc28..cb21f895d1 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1233,9 +1233,11 @@ bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid, gid_t **gids, size_t *num_gids); const char *get_numlist(const char *p, uint32 **num, int *count); bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf); +bool file_exist(const char *fname); bool socket_exist(const char *fname); time_t file_modtime(const char *fname); bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st); +bool directory_exist(char *dname); SMB_OFF_T get_file_size(char *file_name); char *attrib_string(uint16 mode); void show_msg(char *buf); @@ -1263,7 +1265,7 @@ void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size, void *element, void *_array, uint32 *num_elements, ssize_t *array_size); void safe_free(void *p); -char *get_myname_talloc(TALLOC_CTX *ctx); +char *talloc_get_myname(TALLOC_CTX *ctx); char *get_mydnsdomname(TALLOC_CTX *ctx); int interpret_protocol(const char *str,int def); char *automount_lookup(TALLOC_CTX *ctx, const char *user_name); diff --git a/source3/lib/smbconf/smbconf_txt.c b/source3/lib/smbconf/smbconf_txt.c index 1a29f40164..1393a098d5 100644 --- a/source3/lib/smbconf/smbconf_txt.c +++ b/source3/lib/smbconf/smbconf_txt.c @@ -183,7 +183,7 @@ static WERROR smbconf_txt_load_file(struct smbconf_ctx *ctx) WERROR werr; uint64_t new_csn; - if (!file_exist(ctx->path, NULL)) { + if (!file_exist(ctx->path)) { return WERR_BADFILE; } diff --git a/source3/lib/util.c b/source3/lib/util.c index 1cdc5c8ac6..2f1dd83bb1 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2321,7 +2321,7 @@ static char *xx_path(const char *name, const char *rootpath) } trim_string(fname,"","/"); - if (!directory_exist_stat(fname,NULL)) { + if (!directory_exist(fname)) { mkdir(fname,0755); } diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index d9f2af4c10..28de212d69 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -332,7 +332,7 @@ static bool reload_nmbd_services(bool test) if ( lp_loaded() ) { const char *fname = lp_configfile(); - if (file_exist(fname,NULL) && !strcsequal(fname,get_dyn_CONFIGFILE())) { + if (file_exist(fname) && !strcsequal(fname,get_dyn_CONFIGFILE())) { set_dyn_CONFIGFILE(fname); test = False; } @@ -905,7 +905,7 @@ static bool open_sockets(bool isdaemon, int port) } #endif - if (!directory_exist(lp_lockdir(), NULL)) { + if (!directory_exist(lp_lockdir())) { mkdir(lp_lockdir(), 0755); } diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c index 814eaf7ca8..9ee0709cb5 100644 --- a/source3/nmbd/nmbd_processlogon.c +++ b/source3/nmbd/nmbd_processlogon.c @@ -442,7 +442,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", ("get_mydnsdomname failed.\n")); return; } - hostname = get_myname(talloc_tos()); + hostname = talloc_get_myname(talloc_tos()); if (!hostname) { DEBUG(2, ("get_myname failed.\n")); diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index d646a79334..3401bd16a0 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -6930,7 +6930,7 @@ static bool handle_include(int snum, const char *pszParmValue, char **ptr) string_set(ptr, fname); - if (file_exist(fname, NULL)) { + if (file_exist(fname)) { bool ret = pm_process(fname, do_section, do_parameter, NULL); SAFE_FREE(fname); return ret; diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c index ddff7aa24d..eda44ace19 100644 --- a/source3/registry/reg_perfcount.c +++ b/source3/registry/reg_perfcount.c @@ -63,7 +63,7 @@ void perfcount_init_keys( void ) /* no registry keys; just create the perfmon directory */ - if ( !directory_exist( p, NULL ) ) + if ( !directory_exist( p ) ) mkdir( p, 0755 ); return; diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 9d566ea3d6..ca9d3392e7 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -2810,7 +2810,7 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path, result->abstract_syntax = *abstract_syntax; result->transfer_syntax = ndr_transfer_syntax; - result->desthost = get_myname(result); + result->desthost = talloc_get_myname(result); result->srv_name_slash = talloc_asprintf_strupper_m( result, "\\\\%s", result->desthost); if ((result->desthost == NULL) || (result->srv_name_slash == NULL)) { diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c index e232a30078..9215a86d3f 100644 --- a/source3/rpc_server/srv_eventlog_lib.c +++ b/source3/rpc_server/srv_eventlog_lib.c @@ -344,7 +344,7 @@ ELOG_TDB *elog_open_tdb( char *logname, bool force_clear ) /* make sure that the eventlog dir exists */ eventlogdir = state_path( "eventlog" ); - if ( !directory_exist( eventlogdir, NULL ) ) + if ( !directory_exist( eventlogdir ) ) mkdir( eventlogdir, 0755 ); /* get the path on disk */ diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 69a483e4fc..f64ba8c05f 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -840,7 +840,7 @@ bool reload_services(bool test) if (lp_loaded()) { char *fname = lp_configfile(); - if (file_exist(fname, NULL) && + if (file_exist(fname) && !strcsequal(fname, get_dyn_CONFIGFILE())) { set_dyn_CONFIGFILE(fname); test = False; @@ -1319,7 +1319,7 @@ extern void build_options(bool screen); setpgid( (pid_t)0, (pid_t)0); #endif - if (!directory_exist(lp_lockdir(), NULL)) + if (!directory_exist(lp_lockdir())) mkdir(lp_lockdir(), 0755); if (is_daemon) diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c index 56e27eec1d..bb4dc35d2b 100644 --- a/source3/torture/vfstest.c +++ b/source3/torture/vfstest.c @@ -433,7 +433,7 @@ bool reload_services(bool test) if (lp_loaded()) { const char *fname = lp_configfile(); - if (file_exist(fname, NULL) && + if (file_exist(fname) && !strcsequal(fname, get_dyn_CONFIGFILE())) { set_dyn_CONFIGFILE(fname); test = False; diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index 4370d49523..05682efe5d 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -56,7 +56,7 @@ cannot be set in the smb.conf file. nmbd will abort with this setting.\n"); ret = 1; } - if (!directory_exist(lp_lockdir(), &st)) { + if (!directory_exist_stat(lp_lockdir(), &st)) { fprintf(stderr, "ERROR: lock directory %s does not exist\n", lp_lockdir()); ret = 1; @@ -66,7 +66,7 @@ cannot be set in the smb.conf file. nmbd will abort with this setting.\n"); ret = 1; } - if (!directory_exist(lp_piddir(), &st)) { + if (!directory_exist_stat(lp_piddir(), &st)) { fprintf(stderr, "ERROR: pid directory %s does not exist\n", lp_piddir()); ret = 1; diff --git a/source3/web/cgi.c b/source3/web/cgi.c index 7e689bcce8..ce36bd9310 100644 --- a/source3/web/cgi.c +++ b/source3/web/cgi.c @@ -451,7 +451,7 @@ static void cgi_download(char *file) if (S_ISDIR(st.st_mode)) { snprintf(buf, sizeof(buf), "%s/index.html", file); - if (!file_exist(buf, &st) || !S_ISREG(st.st_mode)) + if (!file_exist_stat(buf, &st) || !S_ISREG(st.st_mode)) { cgi_setup_error("404 File Not Found","", "The requested file was not found"); diff --git a/source3/web/swat.c b/source3/web/swat.c index 1502c5bc2f..23fc43f776 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -595,7 +595,7 @@ static void ViewModeBoxes(int mode) ****************************************************************************/ static void welcome_page(void) { - if (file_exist("help/welcome.html", NULL)) { + if (file_exist("help/welcome.html")) { include_html("help/welcome.html"); } else { include_html("help/welcome-no-samba-doc.html"); @@ -1439,7 +1439,7 @@ const char *lang_msg_rotate(TALLOC_CTX *ctx, const char *msgid) cgi_load_variables(); - if (!file_exist(get_dyn_CONFIGFILE(), NULL)) { + if (!file_exist(get_dyn_CONFIGFILE())) { have_read_access = True; have_write_access = True; } else { diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index 9e66eed0c8..f9d3a9fbff 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -228,7 +228,7 @@ static NTSTATUS idmap_tdb_open_db(TALLOC_CTX *memctx, TDB_CONTEXT **tdbctx) goto done; } - if (!file_exist(tdbfile, &stbuf)) { + if (!file_exist_stat(tdbfile, &stbuf)) { tdb_is_new = True; } diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 44b5415726..5d4f21a820 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -66,7 +66,7 @@ static bool reload_services_file(const char *logfile) if (lp_loaded()) { const char *fname = lp_configfile(); - if (file_exist(fname,NULL) && !strcsequal(fname,get_dyn_CONFIGFILE())) { + if (file_exist(fname) && !strcsequal(fname,get_dyn_CONFIGFILE())) { set_dyn_CONFIGFILE(fname); } } @@ -1120,7 +1120,7 @@ int main(int argc, char **argv, char **envp) exit(1); } - if (!directory_exist(lp_lockdir(), NULL)) { + if (!directory_exist(lp_lockdir())) { mkdir(lp_lockdir(), 0755); } diff --git a/source4/smbd/pidfile.c b/source4/smbd/pidfile.c index 3567846070..d8ba240e40 100644 --- a/source4/smbd/pidfile.c +++ b/source4/smbd/pidfile.c @@ -57,7 +57,7 @@ pid_t pidfile_pid(const char *piddir, const char *name) ret = (pid_t)atoi(pidstr); - if (!process_exists(ret)) { + if (!process_exists_by_pid(ret)) { goto noproc; } |