summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-02 20:10:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:05 -0500
commit0a2cc569a1803f459f7db77d03e6e90ae30aa35d (patch)
tree3c7a1ad14eaaa502642ee1704ec1712d9fddee35 /source3
parent8990b13d2f576aac2e32cec91c0a70adf8b58539 (diff)
downloadsamba-0a2cc569a1803f459f7db77d03e6e90ae30aa35d.tar.gz
samba-0a2cc569a1803f459f7db77d03e6e90ae30aa35d.tar.bz2
samba-0a2cc569a1803f459f7db77d03e6e90ae30aa35d.zip
r22045: As Volker noticed, skip_string's last argument is
redundent. Remove it. Jeremy. (This used to be commit 140881cfbb59ce4a699b5900efe02bf315be7bd5)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util.c2
-rw-r--r--source3/lib/util_str.c26
-rw-r--r--source3/libsmb/clidgram.c2
-rw-r--r--source3/libsmb/cliprint.c12
-rw-r--r--source3/libsmb/clirap.c18
-rw-r--r--source3/libsmb/clirap2.c4
-rw-r--r--source3/nmbd/nmbd_browsesync.c2
-rw-r--r--source3/nmbd/nmbd_elections.c2
-rw-r--r--source3/nmbd/nmbd_incomingdgrams.c6
-rw-r--r--source3/nmbd/nmbd_packets.c2
-rw-r--r--source3/nmbd/nmbd_processlogon.c20
-rw-r--r--source3/nmbd/nmbd_sendannounce.c2
-rw-r--r--source3/smbd/lanman.c192
13 files changed, 145 insertions, 145 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index b558571a77..64afa1cc53 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -3168,7 +3168,7 @@ char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t o
return NULL;
}
/* Check if a valid string exists at this offset. */
- if (skip_string(buf_base,buf_len, ptr + off, 1) == NULL) {
+ if (skip_string(buf_base,buf_len, ptr + off) == NULL) {
return NULL;
}
return ptr + off;
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 032627db94..457232c2b2 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -427,20 +427,19 @@ void string_replace( pstring s, char oldc, char newc )
* Skip past some strings in a buffer - old version - no checks.
* **/
-char *push_skip_string(char *buf,size_t n)
+char *push_skip_string(char *buf)
{
- while (n--)
- buf += strlen(buf) + 1;
+ buf += strlen(buf) + 1;
return(buf);
}
/**
- Skip past some strings in a buffer. Buffer may not be
+ Skip past a string in a buffer. Buffer may not be
null terminated. end_ptr points to the first byte after
then end of the buffer.
**/
-char *skip_string(const char *base, size_t len, char *buf, size_t n)
+char *skip_string(const char *base, size_t len, char *buf)
{
const char *end_ptr = base + len;
@@ -448,18 +447,15 @@ char *skip_string(const char *base, size_t len, char *buf, size_t n)
return NULL;
}
- while (n--) {
- /* Skip the string */
- while (*buf) {
- buf++;
- if (buf >= end_ptr) {
- return NULL;
- }
- }
- /* Skip the '\0' */
+ /* Skip the string */
+ while (*buf) {
buf++;
+ if (buf >= end_ptr) {
+ return NULL;
+ }
}
-
+ /* Skip the '\0' */
+ buf++;
return buf;
}
diff --git a/source3/libsmb/clidgram.c b/source3/libsmb/clidgram.c
index b6a9cfb31a..83ea81ddf1 100644
--- a/source3/libsmb/clidgram.c
+++ b/source3/libsmb/clidgram.c
@@ -85,7 +85,7 @@ BOOL cli_send_mailslot(BOOL unique, const char *mailslot,
SSVAL(ptr,smb_vwv16,2);
p2 = smb_buf(ptr);
fstrcpy(p2,mailslot);
- p2 = skip_string(ptr,MAX_DGRAM_SIZE,p2,1);
+ p2 = skip_string(ptr,MAX_DGRAM_SIZE,p2);
if (!p2) {
return False;
}
diff --git a/source3/libsmb/cliprint.c b/source3/libsmb/cliprint.c
index e33a3564eb..cb04e0ddcc 100644
--- a/source3/libsmb/cliprint.c
+++ b/source3/libsmb/cliprint.c
@@ -64,16 +64,16 @@ int cli_print_queue(struct cli_state *cli,
SSVAL(p,0,76); /* API function number 76 (DosPrintJobEnum) */
p += 2;
pstrcpy_base(p,"zWrLeh", param); /* parameter description? */
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
pstrcpy_base(p,"WWzWWDDzz", param); /* returned data format */
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
pstrcpy_base(p,cli->share, param); /* name of queue */
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
SSVAL(p,0,2); /* API function level 2, PRJINFO_2 data structure */
SSVAL(p,2,1000); /* size of bytes of returned data buffer */
p += 4;
pstrcpy_base(p,"", param); /* subformat */
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
DEBUG(4,("doing cli_print_queue for %s\n", cli->share));
@@ -133,9 +133,9 @@ int cli_printjob_del(struct cli_state *cli, int job)
SSVAL(p,0,81); /* DosPrintJobDel() */
p += 2;
pstrcpy_base(p,"W", param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
pstrcpy_base(p,"", param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
SSVAL(p,0,job);
p += 2;
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 3fc95e8429..5891120323 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -86,9 +86,9 @@ BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation)
SSVAL(p,0,132); /* api number */
p += 2;
pstrcpy_base(p,"OOWb54WrLh",param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
pstrcpy_base(p,"WB21BWDWWDDDDDDDzzzD",param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
SSVAL(p,0,1);
p += 2;
pstrcpy_base(p,user,param);
@@ -147,9 +147,9 @@ int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, co
SSVAL(p,0,0); /* api number */
p += 2;
pstrcpy_base(p,"WrLeh",param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
pstrcpy_base(p,"B13BWz",param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
SSVAL(p,0,1);
/*
* Win2k needs a *smaller* buffer than 0xFFFF here -
@@ -225,11 +225,11 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
SSVAL(p,0,0x68); /* api number */
p += 2;
pstrcpy_base(p,"WrLehDz", param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
pstrcpy_base(p,"B16BBDz", param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
SSVAL(p,0,uLevel);
SSVAL(p,2,CLI_BUFFER_SIZE);
p += 4;
@@ -314,11 +314,11 @@ BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char
SSVAL(p,0,214); /* SamOEMChangePassword command. */
p += 2;
pstrcpy_base(p, "zsT", param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
pstrcpy_base(p, "B516B16", param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
pstrcpy_base(p,user, param);
- p = skip_string(param,sizeof(param),p,1);
+ p = skip_string(param,sizeof(param),p);
SSVAL(p,0,532);
p += 2;
diff --git a/source3/libsmb/clirap2.c b/source3/libsmb/clirap2.c
index 9ab8997871..1730626066 100644
--- a/source3/libsmb/clirap2.c
+++ b/source3/libsmb/clirap2.c
@@ -91,7 +91,7 @@
/* put string s at p with max len n and increment p past string */
#define PUTSTRING(p,s,n) do {\
push_ascii(p,s?s:"",n?n:256,STR_TERMINATE);\
- p = push_skip_string(p,1);\
+ p = push_skip_string(p);\
} while(0)
/* put string s and p, using fixed len l, and increment p by l */
#define PUTSTRINGF(p,s,l) do {\
@@ -111,7 +111,7 @@
/* get asciiz string s from p, increment p past string */
#define GETSTRING(p,s) do {\
pull_ascii_pstring(s,p);\
- p = push_skip_string(p,1);\
+ p = push_skip_string(p);\
} while(0)
/* get fixed length l string s from p, increment p by l */
#define GETSTRINGF(p,s,l) do {\
diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c
index ddb223de9f..54d02aac35 100644
--- a/source3/nmbd/nmbd_browsesync.c
+++ b/source3/nmbd/nmbd_browsesync.c
@@ -125,7 +125,7 @@ static void announce_local_master_browser_to_domain_master_browser( struct work_
/* The call below does CH_UNIX -> CH_DOS conversion. JRA */
push_pstring_base(p, myname, outbuf);
- p = skip_string(outbuf,sizeof(outbuf),p,1);
+ p = skip_string(outbuf,sizeof(outbuf),p);
if( DEBUGLVL( 4 ) ) {
dbgtext( "announce_local_master_browser_to_domain_master_browser:\n" );
diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c
index fbdb6c4524..eb6f1b6e0a 100644
--- a/source3/nmbd/nmbd_elections.c
+++ b/source3/nmbd/nmbd_elections.c
@@ -53,7 +53,7 @@ static void send_election_dgram(struct subnet_record *subrec, const char *workgr
strupper_m(srv_name);
/* The following call does UNIX -> DOS charset conversion. */
pstrcpy_base(p, srv_name, outbuf);
- p = skip_string(outbuf,sizeof(outbuf),p,1);
+ p = skip_string(outbuf,sizeof(outbuf),p);
send_mailslot(False, BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
global_myname(), 0,
diff --git a/source3/nmbd/nmbd_incomingdgrams.c b/source3/nmbd/nmbd_incomingdgrams.c
index ec8aa370ce..4f3b3d3a7b 100644
--- a/source3/nmbd/nmbd_incomingdgrams.c
+++ b/source3/nmbd/nmbd_incomingdgrams.c
@@ -435,7 +435,7 @@ void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct
if (!s) {
goto done;
}
- s = skip_string(buf,len,s,1);
+ s = skip_string(buf,len,s);
if (!s) {
goto done;
}
@@ -574,7 +574,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
myname[15]='\0';
push_pstring_base(p, myname, outbuf);
- p = skip_string(outbuf,sizeof(outbuf),p,1);
+ p = skip_string(outbuf,sizeof(outbuf),p);
/* Look for backup browsers in this workgroup. */
@@ -610,7 +610,7 @@ static void send_backup_list_response(struct subnet_record *subrec,
DEBUG(5,("send_backup_list_response: Adding server %s number %d\n",
p, count));
- p = skip_string(outbuf,sizeof(outbuf),p,1);
+ p = skip_string(outbuf,sizeof(outbuf),p);
}
#endif
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 5ec6be1307..87a38b9d2a 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1899,7 +1899,7 @@ BOOL send_mailslot(BOOL unique, const char *mailslot,char *buf, size_t len,
SSVAL(ptr,smb_vwv16,2);
p2 = smb_buf(ptr);
safe_strcpy_base(p2, mailslot, dgram->data, sizeof(dgram->data));
- p2 = skip_string(ptr,MAX_DGRAM_SIZE,p2,1);
+ p2 = skip_string(ptr,MAX_DGRAM_SIZE,p2);
if (((p2+len) > dgram->data+sizeof(dgram->data)) || ((p2+len) < p2)) {
DEBUG(0, ("send_mailslot: Cannot write beyond end of packet\n"));
diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c
index b23e6b996e..ee7d732ae4 100644
--- a/source3/nmbd/nmbd_processlogon.c
+++ b/source3/nmbd/nmbd_processlogon.c
@@ -100,19 +100,19 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
fstring mach_str, user_str, getdc_str;
char *q = buf + 2;
char *machine = q;
- char *user = skip_string(buf,len,machine,1);
+ char *user = skip_string(buf,len,machine);
if (!user || PTR_DIFF(user, buf) >= len) {
DEBUG(0,("process_logon_packet: bad packet\n"));
return;
}
- getdc = skip_string(buf,len,user,1);
+ getdc = skip_string(buf,len,user);
if (!getdc || PTR_DIFF(getdc, buf) >= len) {
DEBUG(0,("process_logon_packet: bad packet\n"));
return;
}
- q = skip_string(buf,len,getdc,1);
+ q = skip_string(buf,len,getdc);
if (!q || PTR_DIFF(q + 5, buf) > len) {
DEBUG(0,("process_logon_packet: bad packet\n"));
@@ -136,7 +136,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
fstrcpy(reply_name, "\\\\");
fstrcat(reply_name, my_name);
push_ascii_fstring(q, reply_name);
- q = skip_string(outbuf,sizeof(outbuf),q, 1); /* PDC name */
+ q = skip_string(outbuf,sizeof(outbuf),q); /* PDC name */
SSVAL(q, 0, token);
q += 2;
@@ -164,13 +164,13 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
return;
}
- getdc = skip_string(buf,len,machine,1);
+ getdc = skip_string(buf,len,machine);
if (!getdc || PTR_DIFF(getdc, buf) >= len) {
DEBUG(0,("process_logon_packet: bad packet\n"));
return;
}
- q = skip_string(buf,len,getdc,1);
+ q = skip_string(buf,len,getdc);
if (!q || PTR_DIFF(q, buf) >= len) {
DEBUG(0,("process_logon_packet: bad packet\n"));
@@ -232,7 +232,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
fstrcpy(reply_name,my_name);
push_ascii_fstring(q, reply_name);
- q = skip_string(outbuf,sizeof(outbuf),q, 1); /* PDC name */
+ q = skip_string(outbuf,sizeof(outbuf),q); /* PDC name */
/* PDC and domain name */
if (!short_request) {
@@ -301,7 +301,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
return;
}
- q = skip_string(buf,len,getdc,1);
+ q = skip_string(buf,len,getdc);
if (!q || PTR_DIFF(q + 8, buf) >= len) {
DEBUG(0,("process_logon_packet: bad packet\n"));
@@ -540,14 +540,14 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
/* Domain info */
- q = skip_string(buf,len,q, 1); /* PDC name */
+ q = skip_string(buf,len,q); /* PDC name */
if (!q || PTR_DIFF(q, buf) >= len) {
DEBUG(0,("process_logon_packet: bad packet\n"));
return;
}
- q = skip_string(buf,len,q, 1); /* Domain name */
+ q = skip_string(buf,len,q); /* Domain name */
if (!q || PTR_DIFF(q, buf) >= len) {
DEBUG(0,("process_logon_packet: bad packet\n"));
diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c
index 0cd481649d..e2dc130463 100644
--- a/source3/nmbd/nmbd_sendannounce.c
+++ b/source3/nmbd/nmbd_sendannounce.c
@@ -566,7 +566,7 @@ for workgroup %s on subnet %s.\n", lp_workgroup(), FIRST_SUBNET->subnet_name ));
myname[15]='\0';
push_pstring_base(p, myname, outbuf);
- p = skip_string(outbuf,sizeof(outbuf),p,1);
+ p = skip_string(outbuf,sizeof(outbuf),p);
for (ptr=s; next_token(&ptr,s2,NULL,sizeof(s2)); ) {
/* The entries are of the form a.b.c.d */
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 1f38f65f3e..0ef6fe1c47 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -778,8 +778,8 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn, uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
char *QueueName = p;
unsigned int uLevel;
int count=0;
@@ -796,7 +796,7 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn, uint16 vuid,
memset((char *)&status,'\0',sizeof(status));
memset((char *)&desc,'\0',sizeof(desc));
- p = skip_string(param,tpscnt,p,1);
+ p = skip_string(param,tpscnt,p);
if (!p) {
return False;
}
@@ -905,8 +905,8 @@ static BOOL api_DosPrintQEnum(connection_struct *conn, uint16 vuid,
int *rdata_len, int *rparam_len)
{
char *param_format = get_safe_str_ptr(param,tpscnt,param,2);
- char *output_format1 = skip_string(param,tpscnt,param_format,1);
- char *p = skip_string(param,tpscnt,output_format1,1);
+ char *output_format1 = skip_string(param,tpscnt,param_format);
+ char *p = skip_string(param,tpscnt,output_format1);
unsigned int uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
char *output_format2 = get_safe_str_ptr(param,tpscnt,p,4);
int services = lp_numservices();
@@ -1279,8 +1279,8 @@ static BOOL api_RNetServerEnum(connection_struct *conn, uint16 vuid,
char **rparam, int *rdata_len, int *rparam_len)
{
char *str1 = get_safe_str_ptr(param, tpscnt, param, 2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel = get_safe_SVAL(param, tpscnt, p, 0, -1);
int buf_len = get_safe_SVAL(param,tpscnt, p, 2, 0);
uint32 servertype = get_safe_IVAL(param,tpscnt,p,4, 0);
@@ -1333,7 +1333,7 @@ static BOOL api_RNetServerEnum(connection_struct *conn, uint16 vuid,
DEBUG(4, ("local_only:%s\n", BOOLSTR(local_request)));
if (strcmp(str1, "WrLehDz") == 0) {
- if (skip_string(param,tpscnt,p,1) == NULL) {
+ if (skip_string(param,tpscnt,p) == NULL) {
return False;
}
pull_ascii_fstring(domain, p);
@@ -1435,8 +1435,8 @@ static BOOL api_RNetGroupGetUsers(connection_struct *conn, uint16 vuid,
char **rparam, int *rdata_len, int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
int buf_len = get_safe_SVAL(param,tpscnt,p,2,0);
int counted=0;
@@ -1625,9 +1625,9 @@ static BOOL api_RNetShareGetInfo(connection_struct *conn,uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *netname = skip_string(param,tpscnt,str2,1);
- char *p = skip_string(param,tpscnt,netname,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *netname = skip_string(param,tpscnt,str2);
+ char *p = skip_string(param,tpscnt,netname);
int uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
int snum;
@@ -1691,8 +1691,8 @@ static BOOL api_RNetShareEnum( connection_struct *conn, uint16 vuid,
int *rparam_len )
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
int buf_len = get_safe_SVAL(param,tpscnt,p,2,0);
char *p2;
@@ -1796,8 +1796,8 @@ static BOOL api_RNetShareAdd(connection_struct *conn,uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
fstring sharename;
fstring comment;
@@ -1823,7 +1823,7 @@ static BOOL api_RNetShareAdd(connection_struct *conn,uint16 vuid,
}
/* Do we have a string ? */
- if (skip_string(data,mdrcnt,data,1) == NULL) {
+ if (skip_string(data,mdrcnt,data) == NULL) {
return False;
}
pull_ascii_fstring(sharename,data);
@@ -1849,7 +1849,7 @@ static BOOL api_RNetShareAdd(connection_struct *conn,uint16 vuid,
}
/* Do we have a string ? */
- if (skip_string(data,mdrcnt,data+offset,1) == NULL) {
+ if (skip_string(data,mdrcnt,data+offset) == NULL) {
return False;
}
pull_ascii_fstring(comment, offset? (data+offset) : "");
@@ -1862,7 +1862,7 @@ static BOOL api_RNetShareAdd(connection_struct *conn,uint16 vuid,
}
/* Do we have a string ? */
- if (skip_string(data,mdrcnt,data+offset,1) == NULL) {
+ if (skip_string(data,mdrcnt,data+offset) == NULL) {
return False;
}
pull_ascii_pstring(pathname, offset? (data+offset) : "");
@@ -1936,8 +1936,8 @@ static BOOL api_RNetGroupEnum(connection_struct *conn,uint16 vuid,
int errflags=0;
int resume_context, cli_buf_size;
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
struct pdb_search *search;
struct samr_displayentry *entries;
@@ -2039,9 +2039,9 @@ static BOOL api_NetUserGetGroups(connection_struct *conn,uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *UserName = skip_string(param,tpscnt,str2,1);
- char *p = skip_string(param,tpscnt,UserName,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *UserName = skip_string(param,tpscnt,str2);
+ char *p = skip_string(param,tpscnt,UserName);
int uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
const char *level_string;
int count=0;
@@ -2185,8 +2185,8 @@ static BOOL api_RNetUserEnum(connection_struct *conn, uint16 vuid,
struct samr_displayentry *users;
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
if (!str1 || !str2 || !p) {
return False;
@@ -2340,21 +2340,25 @@ static BOOL api_SetUserPassword(connection_struct *conn,uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *np = get_safe_str_ptr(param,tpscnt,param,2);
- char *p = skip_string(param,tpscnt,skip_string(param,tpscnt,np,1),1);
+ char *p = NULL;
fstring user;
fstring pass1,pass2;
+ /* Skip 2 strings. */
+ p = skip_string(param,tpscnt,np);
+ p = skip_string(param,tpscnt,p);
+
if (!np || !p) {
return False;
}
/* Do we have a string ? */
- if (skip_string(param,tpscnt,p,1) == NULL) {
+ if (skip_string(param,tpscnt,p) == NULL) {
return False;
}
pull_ascii_fstring(user,p);
- p = skip_string(param,tpscnt,p,1);
+ p = skip_string(param,tpscnt,p);
if (!p) {
return False;
}
@@ -2462,32 +2466,32 @@ static BOOL api_SamOEMChangePassword(connection_struct *conn,uint16 vuid,
*/
/* Do we have a string ? */
- if (skip_string(param,tpscnt,p,1) == 0) {
+ if (skip_string(param,tpscnt,p) == 0) {
return False;
}
if(!strequal(p, "zsT")) {
DEBUG(0,("api_SamOEMChangePassword: Invalid parameter string %s\n", p));
return False;
}
- p = skip_string(param, tpscnt, p, 1);
+ p = skip_string(param, tpscnt, p);
if (!p) {
return False;
}
/* Do we have a string ? */
- if (skip_string(param,tpscnt,p,1) == 0) {
+ if (skip_string(param,tpscnt,p) == 0) {
return False;
}
if(!strequal(p, "B516B16")) {
DEBUG(0,("api_SamOEMChangePassword: Invalid data parameter string %s\n", p));
return False;
}
- p = skip_string(param,tpscnt,p,1);
+ p = skip_string(param,tpscnt,p);
if (!p) {
return False;
}
/* Do we have a string ? */
- if (skip_string(param,tpscnt,p,1) == 0) {
+ if (skip_string(param,tpscnt,p) == 0) {
return False;
}
p += pull_ascii_fstring(user,p);
@@ -2522,8 +2526,8 @@ static BOOL api_RDosPrintJobDel(connection_struct *conn,uint16 vuid,
{
int function = get_safe_SVAL(param,tpscnt,param,0,0);
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
uint32 jobid;
int snum;
fstring sharename;
@@ -2601,8 +2605,8 @@ static BOOL api_WPrintQueueCtrl(connection_struct *conn,uint16 vuid,
{
int function = get_safe_SVAL(param,tpscnt,param,0,0);
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *QueueName = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *QueueName = skip_string(param,tpscnt,str2);
int errcode = NERR_notsupported;
int snum;
WERROR werr = WERR_OK;
@@ -2622,7 +2626,7 @@ static BOOL api_WPrintQueueCtrl(connection_struct *conn,uint16 vuid,
}
*rdata_len = 0;
- if (skip_string(param,tpscnt,QueueName,1) == NULL) {
+ if (skip_string(param,tpscnt,QueueName) == NULL) {
return False;
}
snum = print_queue_snum(QueueName);
@@ -2686,8 +2690,8 @@ static BOOL api_PrintJobInfo(connection_struct *conn, uint16 vuid,
{
struct pack_desc desc;
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
uint32 jobid;
fstring sharename;
int uLevel = get_safe_SVAL(param,tpscnt,p,2,-1);
@@ -2769,8 +2773,8 @@ static BOOL api_RNetServerGetInfo(connection_struct *conn,uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
char *p2;
int struct_len;
@@ -2873,7 +2877,7 @@ static BOOL api_RNetServerGetInfo(connection_struct *conn,uint16 vuid,
current_user_info.domain,
comment, sizeof(comment));
StrnCpy(p2,comment,MAX(mdrcnt - struct_len,0));
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -2910,8 +2914,8 @@ static BOOL api_NetWkstaGetInfo(connection_struct *conn,uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
char *p2;
int level = get_safe_SVAL(param,tpscnt,p,0,-1);
@@ -2950,7 +2954,7 @@ static BOOL api_NetWkstaGetInfo(connection_struct *conn,uint16 vuid,
SIVAL(p,0,PTR_DIFF(p2,*rdata)); /* host name */
pstrcpy(p2,get_local_machine_name());
strupper_m(p2);
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -2958,7 +2962,7 @@ static BOOL api_NetWkstaGetInfo(connection_struct *conn,uint16 vuid,
SIVAL(p,0,PTR_DIFF(p2,*rdata));
pstrcpy(p2,current_user_info.smb_name);
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -2967,7 +2971,7 @@ static BOOL api_NetWkstaGetInfo(connection_struct *conn,uint16 vuid,
SIVAL(p,0,PTR_DIFF(p2,*rdata)); /* login domain */
pstrcpy(p2,lp_workgroup());
strupper_m(p2);
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -2979,7 +2983,7 @@ static BOOL api_NetWkstaGetInfo(connection_struct *conn,uint16 vuid,
SIVAL(p,0,PTR_DIFF(p2,*rdata));
pstrcpy(p2,lp_workgroup()); /* don't know. login domain?? */
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -2987,7 +2991,7 @@ static BOOL api_NetWkstaGetInfo(connection_struct *conn,uint16 vuid,
SIVAL(p,0,PTR_DIFF(p2,*rdata)); /* don't know */
pstrcpy(p2,"");
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3178,9 +3182,9 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *UserName = skip_string(param,tpscnt,str2,1);
- char *p = skip_string(param,tpscnt,UserName,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *UserName = skip_string(param,tpscnt,str2);
+ char *p = skip_string(param,tpscnt,UserName);
int uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
char *p2;
const char *level_string;
@@ -3249,14 +3253,14 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
if (uLevel >= 10) {
SIVAL(p,usri11_comment,PTR_DIFF(p2,p)); /* comment */
pstrcpy(p2,"Comment");
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
SIVAL(p,usri11_usr_comment,PTR_DIFF(p2,p)); /* user_comment */
pstrcpy(p2,"UserComment");
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3264,7 +3268,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
/* EEK! the cifsrap.txt doesn't have this in!!!! */
SIVAL(p,usri11_full_name,PTR_DIFF(p2,p)); /* full name */
pstrcpy(p2,((vuser != NULL) ? vuser->user.full_name : UserName));
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3277,13 +3281,13 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
SIVALS(p,usri11_password_age,-1); /* password age */
SIVAL(p,usri11_homedir,PTR_DIFF(p2,p)); /* home dir */
pstrcpy(p2, vuser && vuser->homedir ? vuser->homedir : "");
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
SIVAL(p,usri11_parms,PTR_DIFF(p2,p)); /* parms */
pstrcpy(p2,"");
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3293,7 +3297,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
SSVALS(p,usri11_num_logons,-1); /* num logons */
SIVAL(p,usri11_logon_server,PTR_DIFF(p2,p)); /* logon server */
pstrcpy(p2,"\\\\*");
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3301,7 +3305,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
SIVAL(p,usri11_workstations,PTR_DIFF(p2,p)); /* workstations */
pstrcpy(p2,"");
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3313,7 +3317,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
/* a simple way to get logon hours at all times. */
memset(p2,0xff,21);
SCVAL(p2,21,0); /* fix zero termination */
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3328,7 +3332,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
conn->admin_user?USER_PRIV_ADMIN:USER_PRIV_USER);
SIVAL(p,44,PTR_DIFF(p2,*rdata)); /* home dir */
pstrcpy(p2, vuser && vuser->homedir ? vuser->homedir : "");
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3337,7 +3341,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
SSVAL(p,52,0); /* flags */
SIVAL(p,54,PTR_DIFF(p2,*rdata)); /* script_path */
pstrcpy(p2,vuser && vuser->logon_script ? vuser->logon_script : "");
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3345,14 +3349,14 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
SIVAL(p,60,0); /* auth_flags */
SIVAL(p,64,PTR_DIFF(p2,*rdata)); /* full_name */
pstrcpy(p2,((vuser != NULL) ? vuser->user.full_name : UserName));
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
SIVAL(p,68,0); /* urs_comment */
SIVAL(p,72,PTR_DIFF(p2,*rdata)); /* parms */
pstrcpy(p2,"");
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3374,7 +3378,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
standard_sub_basic("", "", tmp, sizeof(tmp));
pstrcpy(p2, tmp);
}
- p2 = skip_string(*rdata,*rdata_len,p2,1);
+ p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
}
@@ -3398,8 +3402,8 @@ static BOOL api_WWkstaUserLogon(connection_struct *conn,uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel;
struct pack_desc desc;
char* name;
@@ -3501,15 +3505,15 @@ static BOOL api_WAccessGetUserPerms(connection_struct *conn,uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *user = skip_string(param,tpscnt,str2,1);
- char *resource = skip_string(param,tpscnt,user,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *user = skip_string(param,tpscnt,str2);
+ char *resource = skip_string(param,tpscnt,user);
if (!str1 || !str2 || !user || !resource) {
return False;
}
- if (skip_string(param,tpscnt,resource,1) == NULL) {
+ if (skip_string(param,tpscnt,resource) == NULL) {
return False;
}
DEBUG(3,("WAccessGetUserPerms user=%s resource=%s\n",user,resource));
@@ -3546,8 +3550,8 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn, uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel;
int count;
int i;
@@ -3645,8 +3649,8 @@ static BOOL api_WPrintJobEnumerate(connection_struct *conn, uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
char *name = p;
int uLevel;
int count;
@@ -3663,7 +3667,7 @@ static BOOL api_WPrintJobEnumerate(connection_struct *conn, uint16 vuid,
memset((char *)&desc,'\0',sizeof(desc));
memset((char *)&status,'\0',sizeof(status));
- p = skip_string(param,tpscnt,p,1);
+ p = skip_string(param,tpscnt,p);
if (!p) {
return False;
}
@@ -3798,8 +3802,8 @@ static BOOL api_WPrintDestGetInfo(connection_struct *conn, uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
char* PrinterName = p;
int uLevel;
struct pack_desc desc;
@@ -3812,7 +3816,7 @@ static BOOL api_WPrintDestGetInfo(connection_struct *conn, uint16 vuid,
memset((char *)&desc,'\0',sizeof(desc));
- p = skip_string(param,tpscnt,p,1);
+ p = skip_string(param,tpscnt,p);
if (!p) {
return False;
}
@@ -3878,8 +3882,8 @@ static BOOL api_WPrintDestEnum(connection_struct *conn, uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel;
int queuecnt;
int i, n, succnt=0;
@@ -3959,8 +3963,8 @@ static BOOL api_WPrintDriverEnum(connection_struct *conn, uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel;
int succnt;
struct pack_desc desc;
@@ -4022,8 +4026,8 @@ static BOOL api_WPrintQProcEnum(connection_struct *conn, uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel;
int succnt;
struct pack_desc desc;
@@ -4085,8 +4089,8 @@ static BOOL api_WPrintPortEnum(connection_struct *conn, uint16 vuid,
int *rdata_len,int *rparam_len)
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel;
int succnt;
struct pack_desc desc;
@@ -4155,8 +4159,8 @@ static BOOL api_RNetSessionEnum(connection_struct *conn, uint16 vuid,
{
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
- char *str2 = skip_string(param,tpscnt,str1,1);
- char *p = skip_string(param,tpscnt,str2,1);
+ char *str2 = skip_string(param,tpscnt,str1);
+ char *p = skip_string(param,tpscnt,str2);
int uLevel;
struct pack_desc desc;
struct sessionid *session_list;
@@ -4355,12 +4359,12 @@ int api_reply(connection_struct *conn,uint16 vuid,char *outbuf,char *data,char *
}
api_command = SVAL(params,0);
/* Is there a string at position params+2 ? */
- if (skip_string(params,tpscnt,params+2,1)) {
+ if (skip_string(params,tpscnt,params+2)) {
name1 = params + 2;
} else {
name1 = "";
}
- name2 = skip_string(params,tpscnt,params+2,1);
+ name2 = skip_string(params,tpscnt,params+2);
if (!name2) {
name2 = "";
}