diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-09-05 13:24:20 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-09-05 13:24:20 +0000 |
commit | f6044c87c021342d68d614d59bc8dacd32d223b9 (patch) | |
tree | 1e59411c92f35d49856438bf9f42092100a12064 /source3 | |
parent | 0cb85e04a974daf4442a7561931ff1be566a8410 (diff) | |
download | samba-f6044c87c021342d68d614d59bc8dacd32d223b9.tar.gz samba-f6044c87c021342d68d614d59bc8dacd32d223b9.tar.bz2 samba-f6044c87c021342d68d614d59bc8dacd32d223b9.zip |
some cleanups to use ZERO_STRUCT() and friends
(This used to be commit 7b154dc4313324dfad6cf0117b8ce246bf12bf16)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/auth/pass_check.c | 2 | ||||
-rw-r--r-- | source3/lib/signal.c | 2 | ||||
-rw-r--r-- | source3/lib/util_hnd.c | 4 | ||||
-rw-r--r-- | source3/passdb/pass_check.c | 2 | ||||
-rw-r--r-- | source3/printing/print_svid.c | 2 | ||||
-rw-r--r-- | source3/rpc_client/cli_netlogon.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_lsa_hnd.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe_hnd.c | 4 | ||||
-rw-r--r-- | source3/smbd/conn.c | 4 | ||||
-rw-r--r-- | source3/smbd/filename.c | 5 | ||||
-rw-r--r-- | source3/smbd/files.c | 8 | ||||
-rw-r--r-- | source3/smbd/password.c | 3 | ||||
-rw-r--r-- | source3/utils/smbpasswd.c | 2 |
13 files changed, 23 insertions, 21 deletions
diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c index 9005864b08..edb4c97290 100644 --- a/source3/auth/pass_check.c +++ b/source3/auth/pass_check.c @@ -506,7 +506,7 @@ static BOOL krb5_auth(char *user,char *password) return(False); } - memset((char *)&kcreds, 0, sizeof(kcreds)); + ZERO_STRUCT(kcreds); kcreds.client = kprinc; diff --git a/source3/lib/signal.c b/source3/lib/signal.c index db72b458a7..bb1c6fe189 100644 --- a/source3/lib/signal.c +++ b/source3/lib/signal.c @@ -76,7 +76,7 @@ void CatchSignal(int signum,void (*handler)(int )) #ifdef HAVE_SIGACTION struct sigaction act; - memset(&act, 0, sizeof(act)); + ZERO_STRUCT(act); act.sa_handler = handler; #ifdef SA_RESTART diff --git a/source3/lib/util_hnd.c b/source3/lib/util_hnd.c index addedaec90..b1e695360f 100644 --- a/source3/lib/util_hnd.c +++ b/source3/lib/util_hnd.c @@ -114,7 +114,7 @@ BOOL open_lsa_policy_hnd(POLICY_HND *hnd) return False; } - memset(p, 0, sizeof(*p)); + ZERO_STRUCTP(p); p->open = True; p->pnum = i; @@ -280,7 +280,7 @@ BOOL close_lsa_policy_hnd(POLICY_HND *hnd) bitmap_clear(bmap, p->pnum); - memset(p, 0, sizeof(*p)); + ZERO_STRUCTP(p); free(p); diff --git a/source3/passdb/pass_check.c b/source3/passdb/pass_check.c index 9005864b08..edb4c97290 100644 --- a/source3/passdb/pass_check.c +++ b/source3/passdb/pass_check.c @@ -506,7 +506,7 @@ static BOOL krb5_auth(char *user,char *password) return(False); } - memset((char *)&kcreds, 0, sizeof(kcreds)); + ZERO_STRUCT(kcreds); kcreds.client = kprinc; diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c index f2126f25ac..1f9f75a4fa 100644 --- a/source3/printing/print_svid.c +++ b/source3/printing/print_svid.c @@ -68,7 +68,7 @@ static void populate_printers(void) /* add it to the cache */ if ((ptmp = malloc(sizeof (*ptmp))) != NULL) { - memset(ptmp, '\0', sizeof (*ptmp)); + ZERO_STRUCTP(ptmp); ptmp->name = strdup(name); ptmp->next = printers; printers = ptmp; diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 9d1fde50c0..757c5166e8 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -477,7 +477,7 @@ static BOOL modify_trust_password( char *domain, char *remote_machine, struct in_addr dest_ip; struct cli_state cli; - memset(&cli, '\0', sizeof(struct cli_state)); + ZERO_STRUCT(cli); if(cli_initialise(&cli) == False) { DEBUG(0,("modify_trust_password: unable to initialize client connection.\n")); return False; diff --git a/source3/rpc_server/srv_lsa_hnd.c b/source3/rpc_server/srv_lsa_hnd.c index addedaec90..b1e695360f 100644 --- a/source3/rpc_server/srv_lsa_hnd.c +++ b/source3/rpc_server/srv_lsa_hnd.c @@ -114,7 +114,7 @@ BOOL open_lsa_policy_hnd(POLICY_HND *hnd) return False; } - memset(p, 0, sizeof(*p)); + ZERO_STRUCTP(p); p->open = True; p->pnum = i; @@ -280,7 +280,7 @@ BOOL close_lsa_policy_hnd(POLICY_HND *hnd) bitmap_clear(bmap, p->pnum); - memset(p, 0, sizeof(*p)); + ZERO_STRUCTP(p); free(p); diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 54b9ce1539..3b743188a3 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -98,7 +98,7 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name, pipes_open++; - memset(p, 0, sizeof(*p)); + ZERO_STRUCTP(p); p->pnum = i; p->open = True; @@ -278,7 +278,7 @@ BOOL close_rpc_pipe_hnd(pipes_struct *p, connection_struct *conn) DLIST_REMOVE(Pipes, p); - memset(p, 0, sizeof(*p)); + ZERO_STRUCTP(p); free(p); diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index 2afbfb7d7e..5dc904bd91 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -108,7 +108,7 @@ connection_struct *conn_new(void) conn = (connection_struct *)malloc(sizeof(*conn)); if (!conn) return NULL; - memset(conn, 0, sizeof(*conn)); + ZERO_STRUCTP(conn); conn->cnum = i; bitmap_set(bmap, i); @@ -184,6 +184,6 @@ void conn_free(connection_struct *conn) bitmap_clear(bmap, conn->cnum); num_open--; - memset(conn, 0, sizeof(*conn)); + ZERO_STRUCTP(conn); free(conn); } diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 115ff699c7..8b81d6df2a 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -334,8 +334,9 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component, *dirpath = 0; *bad_path = False; - if(pst) - memset( (char *)pst, '\0', sizeof(SMB_STRUCT_STAT)); + if(pst) { + ZERO_STRUCTP(pst); + } if(saved_last_component) *saved_last_component = 0; diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 0fe6a4ebd1..ed14b86e5f 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -91,7 +91,7 @@ files_struct *file_new(void ) fsp = (files_struct *)malloc(sizeof(*fsp)); if (!fsp) return NULL; - memset(fsp, 0, sizeof(*fsp)); + ZERO_STRUCTP(fsp); first_file = (i+1) % MAX_FNUMS; @@ -166,7 +166,7 @@ file_fd_struct *fd_get_new(void) fd_ptr = (file_fd_struct *)malloc(sizeof(*fd_ptr)); if (!fd_ptr) return NULL; - memset(fd_ptr, 0, sizeof(*fd_ptr)); + ZERO_STRUCTP(fd_ptr); fd_ptr->fdnum = i; fd_ptr->dev = (SMB_DEV_T)-1; @@ -327,7 +327,7 @@ void fd_ptr_free(file_fd_struct *fd_ptr) fd_ptr->fdnum, fd_ptr_used)); /* paranoia */ - memset(fd_ptr, 0, sizeof(*fd_ptr)); + ZERO_STRUCTP(fd_ptr); free(fd_ptr); } @@ -354,7 +354,7 @@ void file_free(files_struct *fsp) /* this is paranoia, just in case someone tries to reuse the information */ - memset(fsp, 0, sizeof(*fsp)); + ZERO_STRUCTP(fsp); if (fsp == chain_fsp) chain_fsp = NULL; diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 684420f4c3..1d90af3066 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -1202,7 +1202,8 @@ machine %s in domain %s.\n", global_myname, global_myworkgroup )); * see if they were valid. */ - memset(&cli, '\0', sizeof(struct cli_state)); + ZERO_STRUCT(cli); + if(cli_initialise(&cli) == False) { DEBUG(0,("domain_client_validate: unable to initialize client connection.\n")); return False; diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index f9b9506297..03553b0ea9 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -430,7 +430,7 @@ int main(int argc, char **argv) exit(1); } - memset(&cli, '\0', sizeof(struct cli_state)); + ZERO_STRUCT(cli); if (!cli_initialise(&cli) || !cli_connect(&cli, remote_machine, &ip)) { fprintf(stderr, "%s: unable to connect to SMB server on machine %s. Error was : %s.\n", |