mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
some cleanups to use ZERO_STRUCT() and friends
(This used to be commit 7b154dc4313324dfad6cf0117b8ce246bf12bf16)
This commit is contained in:
parent
0cb85e04a9
commit
f6044c87c0
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user