summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clidgram.c8
-rw-r--r--source3/libsmb/clifile.c133
-rw-r--r--source3/libsmb/clirap2.c53
-rw-r--r--source3/libsmb/namequery.c4
-rw-r--r--source3/utils/net.c36
5 files changed, 118 insertions, 116 deletions
diff --git a/source3/libsmb/clidgram.c b/source3/libsmb/clidgram.c
index fc1453dce1..e990739de5 100644
--- a/source3/libsmb/clidgram.c
+++ b/source3/libsmb/clidgram.c
@@ -41,7 +41,7 @@ int cli_send_mailslot(int dgram_sock, BOOL unique, char *mailslot,
char *ptr, *p2;
char tmp[4];
- bzero((char *)&p, sizeof(p));
+ memset((char *)&p, '\0', sizeof(p));
/*
* Next, build the DGRAM ...
@@ -183,7 +183,7 @@ int cli_get_backup_list(const char *myname, const char *send_to_name)
/* Now, bind a local addr to it ... Try port 138 first ... */
- bzero((char *)&sock_out, sizeof(sock_out));
+ memset((char *)&sock_out, '\0', sizeof(sock_out));
sock_out.sin_addr.s_addr = INADDR_ANY;
sock_out.sin_port = htons(138);
sock_out.sin_family = AF_INET;
@@ -213,8 +213,8 @@ int cli_get_backup_list(const char *myname, const char *send_to_name)
/* Now, build the request */
- bzero(cli_backup_list, sizeof(cli_backup_list));
- bzero(outbuf, sizeof(outbuf));
+ memset(cli_backup_list, '\0', sizeof(cli_backup_list));
+ memset(outbuf, '\0', sizeof(outbuf));
p = outbuf;
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index d9f8e19910..5c37255278 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -24,49 +24,47 @@
#include "includes.h"
/****************************************************************************
-rename a file
+ Rename a file.
****************************************************************************/
-BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst)
+
+BOOL cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst)
{
- char *p;
+ char *p;
- memset(cli->outbuf,'\0',smb_size);
- memset(cli->inbuf,'\0',smb_size);
+ memset(cli->outbuf,'\0',smb_size);
+ memset(cli->inbuf,'\0',smb_size);
- set_message(cli->outbuf,1, 0, True);
+ set_message(cli->outbuf,1, 0, True);
- CVAL(cli->outbuf,smb_com) = SMBmv;
- SSVAL(cli->outbuf,smb_tid,cli->cnum);
- cli_setup_packet(cli);
+ CVAL(cli->outbuf,smb_com) = SMBmv;
+ SSVAL(cli->outbuf,smb_tid,cli->cnum);
+ cli_setup_packet(cli);
- SSVAL(cli->outbuf,smb_vwv0,aSYSTEM | aHIDDEN | aDIR);
+ SSVAL(cli->outbuf,smb_vwv0,aSYSTEM | aHIDDEN | aDIR);
- p = smb_buf(cli->outbuf);
- *p++ = 4;
- p += clistr_push(cli, p, fname_src, -1,
- STR_TERMINATE);
- *p++ = 4;
- p += clistr_push(cli, p, fname_dst, -1,
- STR_TERMINATE);
+ p = smb_buf(cli->outbuf);
+ *p++ = 4;
+ p += clistr_push(cli, p, fname_src, -1, STR_TERMINATE);
+ *p++ = 4;
+ p += clistr_push(cli, p, fname_dst, -1, STR_TERMINATE);
cli_setup_bcc(cli, p);
- cli_send_smb(cli);
- if (!cli_receive_smb(cli)) {
- return False;
- }
+ cli_send_smb(cli);
+ if (!cli_receive_smb(cli))
+ return False;
- if (cli_is_error(cli)) {
- return False;
- }
+ if (cli_is_error(cli))
+ return False;
- return True;
+ return True;
}
/****************************************************************************
-delete a file
+ Delete a file.
****************************************************************************/
-BOOL cli_unlink(struct cli_state *cli, char *fname)
+
+BOOL cli_unlink(struct cli_state *cli, const char *fname)
{
char *p;
@@ -99,9 +97,10 @@ BOOL cli_unlink(struct cli_state *cli, char *fname)
}
/****************************************************************************
-create a directory
+ Create a directory.
****************************************************************************/
-BOOL cli_mkdir(struct cli_state *cli, char *dname)
+
+BOOL cli_mkdir(struct cli_state *cli, const char *dname)
{
char *p;
@@ -133,9 +132,10 @@ BOOL cli_mkdir(struct cli_state *cli, char *dname)
}
/****************************************************************************
-remove a directory
+ Remove a directory.
****************************************************************************/
-BOOL cli_rmdir(struct cli_state *cli, char *dname)
+
+BOOL cli_rmdir(struct cli_state *cli, const char *dname)
{
char *p;
@@ -208,7 +208,7 @@ int cli_nt_delete_on_close(struct cli_state *cli, int fnum, BOOL flag)
}
/****************************************************************************
- open a file - exposing the full horror of the NT API :-).
+ Open a file - exposing the full horror of the NT API :-).
Used in smbtorture.
****************************************************************************/
@@ -265,7 +265,7 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, uint32 DesiredA
}
/****************************************************************************
-open a file
+ Open a file.
****************************************************************************/
int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess)
@@ -275,9 +275,10 @@ int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess
}
/****************************************************************************
-open a file
-WARNING: if you open with O_WRONLY then getattrE won't work!
+ Open a file
+ WARNING: if you open with O_WRONLY then getattrE won't work!
****************************************************************************/
+
int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode)
{
char *p;
@@ -352,12 +353,10 @@ int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode
return SVAL(cli->inbuf,smb_vwv2);
}
-
-
-
/****************************************************************************
- close a file
+ Close a file.
****************************************************************************/
+
BOOL cli_close(struct cli_state *cli, int fnum)
{
memset(cli->outbuf,'\0',smb_size);
@@ -380,15 +379,15 @@ BOOL cli_close(struct cli_state *cli, int fnum)
return !cli_is_error(cli);
}
-
/****************************************************************************
- lock a file
+ Lock a file.
****************************************************************************/
+
BOOL cli_lock(struct cli_state *cli, int fnum,
uint32 offset, uint32 len, int timeout, enum brl_type lock_type)
{
char *p;
- int saved_timeout = cli->timeout;
+ int saved_timeout = cli->timeout;
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0', smb_size);
@@ -417,10 +416,10 @@ BOOL cli_lock(struct cli_state *cli, int fnum,
cli_send_smb(cli);
- cli->timeout = (timeout == -1) ? 0x7FFFFFFF : (timeout + 2*1000);
+ cli->timeout = (timeout == -1) ? 0x7FFFFFFF : (timeout + 2*1000);
if (!cli_receive_smb(cli)) {
- cli->timeout = saved_timeout;
+ cli->timeout = saved_timeout;
return False;
}
@@ -434,8 +433,9 @@ BOOL cli_lock(struct cli_state *cli, int fnum,
}
/****************************************************************************
- unlock a file
+ Unlock a file.
****************************************************************************/
+
BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len)
{
char *p;
@@ -474,10 +474,10 @@ BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len)
return True;
}
-
/****************************************************************************
- lock a file with 64 bit offsets
+ Lock a file with 64 bit offsets.
****************************************************************************/
+
BOOL cli_lock64(struct cli_state *cli, int fnum,
SMB_BIG_UINT offset, SMB_BIG_UINT len, int timeout, enum brl_type lock_type)
{
@@ -534,8 +534,9 @@ BOOL cli_lock64(struct cli_state *cli, int fnum,
}
/****************************************************************************
- unlock a file with 64 bit offsets
+ Unlock a file with 64 bit offsets.
****************************************************************************/
+
BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len)
{
char *p;
@@ -578,13 +579,10 @@ BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_
return True;
}
-
-
-
-
/****************************************************************************
-do a SMBgetattrE call
+ Do a SMBgetattrE call.
****************************************************************************/
+
BOOL cli_getattrE(struct cli_state *cli, int fd,
uint16 *attr, size_t *size,
time_t *c_time, time_t *a_time, time_t *m_time)
@@ -632,11 +630,11 @@ BOOL cli_getattrE(struct cli_state *cli, int fd,
return True;
}
-
/****************************************************************************
-do a SMBgetatr call
+ Do a SMBgetatr call
****************************************************************************/
-BOOL cli_getatr(struct cli_state *cli, char *fname,
+
+BOOL cli_getatr(struct cli_state *cli, const char *fname,
uint16 *attr, size_t *size, time_t *t)
{
char *p;
@@ -681,11 +679,11 @@ BOOL cli_getatr(struct cli_state *cli, char *fname,
return True;
}
-
/****************************************************************************
-do a SMBsetatr call
+ Do a SMBsetatr call.
****************************************************************************/
-BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t)
+
+BOOL cli_setatr(struct cli_state *cli, const char *fname, uint16 attr, time_t t)
{
char *p;
@@ -720,11 +718,11 @@ BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t)
return True;
}
-
/****************************************************************************
-check for existance of a dir
+ Check for existance of a dir.
****************************************************************************/
-BOOL cli_chkpath(struct cli_state *cli, char *path)
+
+BOOL cli_chkpath(struct cli_state *cli, const char *path)
{
pstring path2;
char *p;
@@ -754,11 +752,10 @@ BOOL cli_chkpath(struct cli_state *cli, char *path)
return True;
}
-
-
/****************************************************************************
-query disk space
+ Query disk space.
****************************************************************************/
+
BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail)
{
memset(cli->outbuf,'\0',smb_size);
@@ -779,11 +776,11 @@ BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail)
return True;
}
-
/****************************************************************************
-create and open a temporary file
+ Create and open a temporary file.
****************************************************************************/
-int cli_ctemp(struct cli_state *cli, char *path, char **tmp_path)
+
+int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path)
{
int len;
char *p;
diff --git a/source3/libsmb/clirap2.c b/source3/libsmb/clirap2.c
index f19ec3e758..2fde0c70e5 100644
--- a/source3/libsmb/clirap2.c
+++ b/source3/libsmb/clirap2.c
@@ -149,7 +149,7 @@ static char *make_header(char *param, uint16 apinum, char *reqfmt, char *datafmt
/****************************************************************************
call a NetGroupDelete - delete user group from remote server
****************************************************************************/
-int cli_NetGroupDelete(struct cli_state *cli, char * group_name )
+int cli_NetGroupDelete(struct cli_state *cli, const char *group_name )
{
char *rparam = NULL;
char *rdata = NULL;
@@ -277,7 +277,7 @@ int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char
int res = -1;
- bzero(param, sizeof(param));
+ memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WGroupEnum,
RAP_NetGroupEnum_REQ, RAP_GROUP_INFO_L1);
PUTWORD(p,1); /* Info level 1 */ /* add level 0 */
@@ -328,7 +328,7 @@ int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char
return res;
}
-int cli_NetGroupDelUser(struct cli_state * cli, char * group_name, char * user_name)
+int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const char *user_name)
{
char *rparam = NULL;
char *rdata = NULL;
@@ -386,7 +386,7 @@ int cli_NetGroupDelUser(struct cli_state * cli, char * group_name, char * user_n
return res;
}
-int cli_NetGroupAddUser(struct cli_state * cli, char * group_name, char * user_name)
+int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name)
{
char *rparam = NULL;
char *rdata = NULL;
@@ -442,7 +442,7 @@ int cli_NetGroupAddUser(struct cli_state * cli, char * group_name, char * user_n
}
-int cli_NetGroupGetUsers(struct cli_state * cli, char * group_name, void (*fn)(const char *, void *), void *state )
+int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*fn)(const char *, void *), void *state )
{
char *rparam = NULL;
char *rdata = NULL;
@@ -497,7 +497,7 @@ int cli_NetGroupGetUsers(struct cli_state * cli, char * group_name, void (*fn)(c
return res;
}
-int cli_NetUserGetGroups(struct cli_state * cli, char * user_name, void (*fn)(const char *, void *), void *state )
+int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*fn)(const char *, void *), void *state )
{
char *rparam = NULL;
char *rdata = NULL;
@@ -556,7 +556,7 @@ int cli_NetUserGetGroups(struct cli_state * cli, char * user_name, void (*fn)(co
/****************************************************************************
call a NetUserDelete - delete user from remote server
****************************************************************************/
-int cli_NetUserDelete(struct cli_state *cli, char * user_name )
+int cli_NetUserDelete(struct cli_state *cli, const char * user_name )
{
char *rparam = NULL;
char *rdata = NULL;
@@ -647,7 +647,7 @@ int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo )
PUTWORD(p, 0); /* password length */
p = data;
- bzero(data, soffset);
+ memset(data, '\0', soffset);
PUTSTRINGF(p, userinfo->user_name, RAP_USERNAME_LEN);
PUTBYTE(p, 0); /* pad byte 0 */
@@ -707,7 +707,7 @@ int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char
int res = -1;
- bzero(param, sizeof(param));
+ memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WUserEnum,
RAP_NetUserEnum_REQ, RAP_USER_INFO_L1);
PUTWORD(p,1); /* Info level 1 */
@@ -984,7 +984,7 @@ int cli_NetShareAdd(struct cli_state *cli, RAP_SHARE_INFO_2 * sinfo )
+ DWORDSIZE /* share path */
+ RAP_SPASSWD_LEN + 1; /* share password + pad */
- bzero(param,sizeof(param));
+ memset(param,'\0',sizeof(param));
/* now send a SMBtrans command with api RNetShareAdd */
p = make_header(param, RAP_WshareAdd,
RAP_WShareAdd_REQ, RAP_SHARE_INFO_L2);
@@ -1031,7 +1031,7 @@ int cli_NetShareAdd(struct cli_state *cli, RAP_SHARE_INFO_2 * sinfo )
/****************************************************************************
call a NetShareDelete - unshare exported directory on remote server
****************************************************************************/
-int cli_NetShareDelete(struct cli_state *cli, char * share_name )
+int cli_NetShareDelete(struct cli_state *cli, const char * share_name )
{
char *rparam = NULL;
char *rdata = NULL;
@@ -1424,7 +1424,9 @@ BOOL cli_NetWkstaUserLogoff(struct cli_state *cli,char *user, char *workstation)
return (cli->rap_error == 0);
}
-int cli_NetPrintQEnum(struct cli_state *cli, void (*qfn)(char*,uint16,uint16,uint16,char*,char*,char*,char*,char*,uint16,uint16),void (*jfn)(uint16,char*,char*,char*,char*,uint16,uint16,char*,uint,uint,char*))
+int cli_NetPrintQEnum(struct cli_state *cli,
+ void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
+ void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint,uint,const char*))
{
char param[WORDSIZE /* api number */
+sizeof(RAP_NetPrintQEnum_REQ) /* req string */
@@ -1439,7 +1441,7 @@ int cli_NetPrintQEnum(struct cli_state *cli, void (*qfn)(char*,uint16,uint16,ui
int res = -1;
- bzero(param, sizeof(param));
+ memset(param, '\0',sizeof(param));
p = make_header(param, RAP_WPrintQEnum,
RAP_NetPrintQEnum_REQ, RAP_PRINTQ_INFO_L2);
PUTWORD(p,2); /* Info level 2 */
@@ -1525,7 +1527,9 @@ int cli_NetPrintQEnum(struct cli_state *cli, void (*qfn)(char*,uint16,uint16,ui
return res;
}
-int cli_NetPrintQGetInfo(struct cli_state *cli, char *printer, void (*qfn)(char*,uint16,uint16,uint16,char*,char*,char*,char*,char*,uint16,uint16),void (*jfn)(uint16,char*,char*,char*,char*,uint16,uint16,char*,uint,uint,char*))
+int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
+ void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
+ void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint,uint,const char*))
{
char param[WORDSIZE /* api number */
+sizeof(RAP_NetPrintQGetInfo_REQ) /* req string */
@@ -1541,7 +1545,7 @@ int cli_NetPrintQGetInfo(struct cli_state *cli, char *printer, void (*qfn)(char*
int res = -1;
- bzero(param, sizeof(param));
+ memset(param, '\0',sizeof(param));
p = make_header(param, RAP_WPrintQGetInfo,
RAP_NetPrintQGetInfo_REQ, RAP_PRINTQ_INFO_L2);
PUTSTRING(p, printer, RAP_SHARENAME_LEN-1);
@@ -1640,7 +1644,7 @@ int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const ch
int res = -1;
- bzero(param, sizeof(param));
+ memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WServiceEnum,
RAP_NetServiceEnum_REQ, RAP_SERVICE_INFO_L2);
PUTWORD(p,2); /* Info level 2 */
@@ -1708,7 +1712,7 @@ int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16,
int rprcnt, rdrcnt;
int res = -1;
- bzero(param, sizeof(param));
+ memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WsessionEnum,
RAP_NetSessionEnum_REQ, RAP_SESSION_INFO_L2);
PUTWORD(p,2); /* Info level 2 */
@@ -1767,9 +1771,10 @@ int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16,
}
/****************************************************************************
-call a NetSessionGetInfo - get information about other session to an SMB server
+ Call a NetSessionGetInfo - get information about other session to an SMB server.
****************************************************************************/
-int cli_NetSessionGetInfo(struct cli_state *cli, char *workstation, void (*fn)(char *, char *, uint16, uint16, uint16, uint, uint, uint, char *))
+
+int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation, void (*fn)(const char *, const char *, uint16, uint16, uint16, uint, uint, uint, const char *))
{
char param[WORDSIZE /* api number */
+sizeof(RAP_NetSessionGetInfo_REQ) /* req string */
@@ -1784,7 +1789,7 @@ int cli_NetSessionGetInfo(struct cli_state *cli, char *workstation, void (*fn)(c
int res = -1;
- bzero(param, sizeof(param));
+ memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WsessionGetInfo,
RAP_NetSessionGetInfo_REQ, RAP_SESSION_INFO_L2);
PUTSTRING(p, workstation, RAP_MACHNAME_LEN-1);
@@ -1844,7 +1849,7 @@ int cli_NetSessionGetInfo(struct cli_state *cli, char *workstation, void (*fn)(c
/****************************************************************************
call a NetSessionDel - close a session to an SMB server
****************************************************************************/
-int cli_NetSessionDel(struct cli_state *cli, char *workstation)
+int cli_NetSessionDel(struct cli_state *cli, const char *workstation)
{
char param[WORDSIZE /* api number */
+sizeof(RAP_NetSessionDel_REQ) /* req string */
@@ -1857,7 +1862,7 @@ int cli_NetSessionDel(struct cli_state *cli, char *workstation)
int rprcnt, rdrcnt;
int res;
- bzero(param, sizeof(param));
+ memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WsessionDel, RAP_NetSessionDel_REQ, NULL);
PUTSTRING(p, workstation, RAP_MACHNAME_LEN-1);
PUTWORD(p,0); /* reserved word of 0 */
@@ -1888,7 +1893,7 @@ int cli_NetSessionDel(struct cli_state *cli, char *workstation)
}
-int cli_NetConnectionEnum(struct cli_state *cli, char *qualifier, void (*fn)(uint16 conid, uint16 contype, uint16 numopens, uint16 numusers, uint32 contime, char *username, char *netname))
+int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier, void (*fn)(uint16 conid, uint16 contype, uint16 numopens, uint16 numusers, uint32 contime, const char *username, const char *netname))
{
char param[WORDSIZE /* api number */
+sizeof(RAP_NetConnectionEnum_REQ) /* req string */
@@ -1902,7 +1907,7 @@ int cli_NetConnectionEnum(struct cli_state *cli, char *qualifier, void (*fn)(uin
int rprcnt, rdrcnt;
int res = -1;
- bzero(param, sizeof(param));
+ memset(param, '\0', sizeof(param));
p = make_header(param, RAP_WconnectionEnum,
RAP_NetConnectionEnum_REQ, RAP_CONNECTION_INFO_L1);
PUTSTRING(p, qualifier, RAP_MACHNAME_LEN-1);/* Workstation name */
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 0dbf4b4564..1e284aab19 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -205,7 +205,7 @@ BOOL name_register(int fd, const char *name, int name_type,
register_ip.s_addr = name_ip.s_addr; /* Fix this ... */
- bzero((char *)&p, sizeof(p));
+ memset((char *)&p, '\0', sizeof(p));
*count = 0;
@@ -237,7 +237,7 @@ BOOL name_register(int fd, const char *name, int name_type,
}
- bzero((char *)nmb->additional, sizeof(struct res_rec));
+ memset((char *)nmb->additional, '\0', sizeof(struct res_rec));
nmb->additional->rr_name = nmb->question.question_name;
nmb->additional->rr_type = RR_TYPE_NB;
diff --git a/source3/utils/net.c b/source3/utils/net.c
index dcbc58017d..5621a7eefb 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -519,7 +519,7 @@ static void one_file_fn(const char *pPath, const char *pUser, uint16 perms, uint
printf(FILE_INFO_DISPLAY, id, pUser, locks, pPath, perms);
}
-int net_file(int subfunct, char * id)
+int net_file(int subfunct, const char * id)
{
struct in_addr target_ip;
@@ -583,7 +583,7 @@ void share_fn(const char *share_name, uint32 type, const char *comment, void *st
printf("%-12.12s\n", share_name);
}
-int net_share(int subfunct, char * sharename, char * comment, int maxusers)
+int net_share(int subfunct, const char * sharename, const char * comment, int maxusers)
{
struct in_addr target_ip;
@@ -634,7 +634,7 @@ int net_share(int subfunct, char * sharename, char * comment, int maxusers)
sinfo.maximum_users = maxusers;
sinfo.active_users = 0;
sinfo.path = p+1;
- bzero(sinfo.password, sizeof(sinfo.password));
+ memset(sinfo.password, '\0', sizeof(sinfo.password));
sinfo.reserved2 = '\0';
return cli_NetShareAdd(cli, &sinfo);
@@ -674,9 +674,9 @@ void list_sessions_func(char *wsname, char *username, uint16 conns,
wsname, username, clitype, opens, hrs, min, sec);
}
-void display_session_func(char *wsname, char *username, uint16 conns,
+void display_session_func(const char *wsname, const char *username, uint16 conns,
uint16 opens, uint16 users, uint32 sess_time,
- uint32 idle_time, uint32 user_flags, char *clitype)
+ uint32 idle_time, uint32 user_flags, const char *clitype)
{
int ihrs = idle_time / 3600;
int imin = (idle_time / 60) % 60;
@@ -689,12 +689,12 @@ void display_session_func(char *wsname, char *username, uint16 conns,
shrs, smin, ssec, ihrs, imin, isec);
}
-void display_conns_func(uint16 conn_id, uint16 conn_type, uint16 opens, uint16 users, uint32 conn_time, char *username, char *netname)
+void display_conns_func(uint16 conn_id, uint16 conn_type, uint16 opens, uint16 users, uint32 conn_time, const char *username, const char *netname)
{
printf("%-14.14s %-8.8s %5d\n", netname, share_type[conn_type], opens);
}
-int net_session(int subfunct, char * sessname)
+int net_session(int subfunct, const char * sessname)
{
struct in_addr target_ip;
int res;
@@ -871,7 +871,7 @@ void printq_usage(void)
printf(CONF_USAGE);
}
-void enum_queue(char *queuename, uint16 pri, uint16 start, uint16 until, char *sep, char *pproc, char *dest, char *qparms, char *qcomment, uint16 status, uint16 jobcount) {
+void enum_queue(const char *queuename, uint16 pri, uint16 start, uint16 until, const char *sep, const char *pproc, const char *dest, const char *qparms, const char *qcomment, uint16 status, uint16 jobcount) {
pstring queuecol;
pstring statcol;
@@ -897,7 +897,7 @@ void enum_queue(char *queuename, uint16 pri, uint16 start, uint16 until, char *s
printf(PRINTQ_DISPLAY_ONE, queuecol, jobcount, statcol);
}
-void enum_jobs(uint16 jobid, char *ownername, char *notifyname, char *datatype, char *jparms, uint16 pos, uint16 status, char *jstatus, uint submitted, uint jobsize, char *comment) {
+void enum_jobs(uint16 jobid, const char *ownername, const char *notifyname, const char *datatype, const char *jparms, uint16 pos, uint16 status, const char *jstatus, uint submitted, uint jobsize, const char *comment) {
pstring statcol;
switch (status) {
@@ -919,7 +919,7 @@ void enum_jobs(uint16 jobid, char *ownername, char *notifyname, char *datatype,
printf(PRINTQ_DISPLAY_JOB, ownername, jobid, jobsize, statcol);
}
-int net_printq(int subfunct, char * printq, int jobid)
+int net_printq(int subfunct, const char *printq, int jobid)
{
struct in_addr target_ip;
@@ -992,7 +992,7 @@ void group_member_fn(const char *user_name, void *state)
printf("%-21.21s\n", user_name);
}
-int net_user(int subfunct, char * username, char * comment, int flags)
+int net_user(int subfunct, const char * username, const char * comment, int flags)
{
struct in_addr target_ip;
@@ -1092,7 +1092,7 @@ void group_fn(const char *group_name, const char *comment, void *state)
printf("%-21.21s\n", group_name);
}
-int net_group(int subfunct, char * groupname, char * comment)
+int net_group(int subfunct, const char * groupname, const char * comment)
{
struct in_addr target_ip;
@@ -1165,7 +1165,7 @@ void groupmember_usage(void)
}
-int net_groupmember(int subfunct, char * groupname, char * username)
+int net_groupmember(int subfunct, const char * groupname, const char * username)
{
struct in_addr target_ip;
@@ -1250,7 +1250,7 @@ void service_usage(void)
}
-int net_service(int subfunct, char * servicename, char * srvc_args)
+int net_service(int subfunct, const char * servicename, const char * srvc_args)
{
struct in_addr target_ip;
@@ -1285,7 +1285,7 @@ return -1;
}
-int net_password(char * username, char * old_password, char * new_password)
+int net_password(const char * username, const char * old_password, const char * new_password)
{
struct in_addr target_ip;
@@ -1349,7 +1349,7 @@ void admin_usage(void)
}
-int net_admin(char * command, char * cmd_args, char * environment)
+int net_admin(const char * command, const char * cmd_args, const char * environment)
{
printf(ERRMSG_NOT_IMPLEMENTED);
return 0;
@@ -1367,7 +1367,7 @@ int main(int argc,char *argv[])
int func = 0;
int subfunc = LIST_SF;
int argc_new = 0;
- char ** argv_new;
+ const char ** argv_new;
poptContext pc;
static char *servicesf = CONFIGFILE;
static char *target_workgroup = NULL;
@@ -1442,7 +1442,7 @@ int main(int argc,char *argv[])
lp_load(servicesf,True,False,False);
- argv_new = (char **)poptGetArgs(pc);
+ argv_new = (const char **)poptGetArgs(pc);
argc_new = argc;
for (i=0; i<argc; i++) {