{
fstring buf;
- if (next_token(NULL,buf,NULL,sizeof(buf)))
+ if (next_token_nr(NULL,buf,NULL,sizeof(buf)))
do_cd(buf);
else
DEBUG(0,("Current directory is %s\n",cur_dir));
if(mask[strlen(mask)-1]!='\\')
pstrcat(mask,"\\");
- if (next_token(NULL,buf,NULL,sizeof(buf))) {
+ if (next_token_nr(NULL,buf,NULL,sizeof(buf))) {
dos_format(p);
if (*p == '\\')
pstrcpy(mask,p);
if(mask[strlen(mask)-1]!='\\')
pstrcat(mask,"\\");
- if (next_token(NULL,buf,NULL,sizeof(buf))) {
+ if (next_token_nr(NULL,buf,NULL,sizeof(buf))) {
dos_format(p);
if (*p == '\\')
pstrcpy(mask,p);
p = rname + strlen(rname);
- if (!next_token(NULL,p,NULL,sizeof(rname)-strlen(rname))) {
+ if (!next_token_nr(NULL,p,NULL,sizeof(rname)-strlen(rname))) {
DEBUG(0,("get <filename>\n"));
return;
}
pstrcpy(lname,p);
dos_clean_name(rname);
- next_token(NULL,lname,NULL,sizeof(lname));
+ next_token_nr(NULL,lname,NULL,sizeof(lname));
do_get(rname, lname);
}
}
close(fd);
- if (!next_token(NULL,rname+strlen(rname),NULL,sizeof(rname)-strlen(rname))) {
+ if (!next_token_nr(NULL,rname+strlen(rname),NULL,sizeof(rname)-strlen(rname))) {
DEBUG(0,("more <filename>\n"));
unlink(lname);
return;
abort_mget = False;
- while (next_token(NULL,p,NULL,sizeof(buf))) {
+ while (next_token_nr(NULL,p,NULL,sizeof(buf))) {
pstrcpy(mget_mask,cur_dir);
if(mget_mask[strlen(mget_mask)-1]!='\\')
pstrcat(mget_mask,"\\");
pstrcpy(mask,cur_dir);
- if (!next_token(NULL,p,NULL,sizeof(buf))) {
+ if (!next_token_nr(NULL,p,NULL,sizeof(buf))) {
if (!recurse)
DEBUG(0,("mkdir <dirname>\n"));
return;
pstrcpy(rname,cur_dir);
pstrcat(rname,"\\");
- if (!next_token(NULL,p,NULL,sizeof(buf))) {
+ if (!next_token_nr(NULL,p,NULL,sizeof(buf))) {
DEBUG(0,("put <filename>\n"));
return;
}
pstrcpy(lname,p);
- if (next_token(NULL,p,NULL,sizeof(buf)))
+ if (next_token_nr(NULL,p,NULL,sizeof(buf)))
pstrcat(rname,p);
else
pstrcat(rname,lname);
static void cmd_select(void)
{
pstrcpy(fileselection,"");
- next_token(NULL,fileselection,NULL,sizeof(fileselection));
+ next_token_nr(NULL,fileselection,NULL,sizeof(fileselection));
}
/****************************************************************************
fstring buf;
char *p=buf;
- while (next_token(NULL,p,NULL,sizeof(buf))) {
+ while (next_token_nr(NULL,p,NULL,sizeof(buf))) {
int ret;
struct file_list *temp_list;
char *quest, *lname, *rname;
fstring buf;
int job;
- if (!next_token(NULL,buf,NULL,sizeof(buf))) {
+ if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
printf("cancel <jobid> ...\n");
return;
}
do {
job = atoi(buf);
do_cancel(job);
- } while (next_token(NULL,buf,NULL,sizeof(buf)));
+ } while (next_token_nr(NULL,buf,NULL,sizeof(buf)));
}
pstring rname;
char *p;
- if (!next_token(NULL,lname,NULL, sizeof(lname))) {
+ if (!next_token_nr(NULL,lname,NULL, sizeof(lname))) {
DEBUG(0,("print <filename>\n"));
return;
}
pstrcpy(mask,cur_dir);
- if (!next_token(NULL,buf,NULL,sizeof(buf))) {
+ if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
DEBUG(0,("del <filename>\n"));
return;
}
pstrcpy(mask,cur_dir);
- if (!next_token(NULL,buf,NULL,sizeof(buf))) {
+ if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
DEBUG(0,("del <filename>\n"));
return;
}
pstrcpy(mask,cur_dir);
- if (!next_token(NULL,buf,NULL,sizeof(buf))) {
+ if (!next_token_nr(NULL,buf,NULL,sizeof(buf))) {
DEBUG(0,("rmdir <dirname>\n"));
return;
}
pstrcpy(src,cur_dir);
pstrcpy(dest,cur_dir);
- if (!next_token(NULL,buf,NULL,sizeof(buf)) ||
- !next_token(NULL,buf2,NULL, sizeof(buf2))) {
+ if (!next_token_nr(NULL,buf,NULL,sizeof(buf)) ||
+ !next_token_nr(NULL,buf2,NULL, sizeof(buf2))) {
DEBUG(0,("rename <src> <dest>\n"));
return;
}
BOOL ok;
SMB_STRUCT_STAT sbuf;
- ok = next_token(NULL,buf,NULL,sizeof(buf));
+ ok = next_token_nr(NULL,buf,NULL,sizeof(buf));
if (ok && (sys_stat(buf,&sbuf) == 0)) {
newer_than = sbuf.st_mtime;
DEBUG(1,("Getting files newer than %s",
{
fstring buf;
- if (next_token(NULL,buf,NULL,sizeof(buf))) {
+ if (next_token_nr(NULL,buf,NULL,sizeof(buf))) {
archive_level = atoi(buf);
} else
DEBUG(0,("Archive level is %d\n",archive_level));
fstring buf;
fstring mode;
- if (next_token(NULL,buf,NULL,sizeof(buf))) {
+ if (next_token_nr(NULL,buf,NULL,sizeof(buf))) {
if (strequal(buf,"text")) {
printmode = 0;
} else {
fstring buf;
pstring d;
- if (next_token(NULL,buf,NULL,sizeof(buf)))
+ if (next_token_nr(NULL,buf,NULL,sizeof(buf)))
chdir(buf);
DEBUG(2,("the local directory is now %s\n",sys_getwd(d)));
}
int i=0,j;
fstring buf;
- if (next_token(NULL,buf,NULL,sizeof(buf))) {
+ if (next_token_nr(NULL,buf,NULL,sizeof(buf))) {
if ((i = process_tok(buf)) >= 0)
DEBUG(0,("HELP %s:\n\t%s\n\n",commands[i].name,commands[i].description));
} else {
/* and get the first part of the command */
ptr = line;
- if (!next_token(&ptr,tok,NULL,sizeof(tok))) continue;
+ if (!next_token_nr(&ptr,tok,NULL,sizeof(tok))) continue;
if ((i = process_tok(tok)) >= 0) {
commands[i].fn();
/* and get the first part of the command */
ptr = line;
- if (!next_token(&ptr,tok,NULL,sizeof(tok))) continue;
+ if (!next_token_nr(&ptr,tok,NULL,sizeof(tok))) continue;
if ((i = process_tok(tok)) >= 0) {
commands[i].fn();
fstring buf;
int block;
- if (!next_token(NULL,buf,NULL,sizeof(buf)))
+ if (!next_token_nr(NULL,buf,NULL,sizeof(buf)))
{
DEBUG(0, ("blocksize <n>\n"));
return;
{
fstring buf;
- while (next_token(NULL,buf,NULL,sizeof(buf))) {
+ while (next_token_nr(NULL,buf,NULL,sizeof(buf))) {
if (strequal(buf, "full"))
tar_inc=False;
else if (strequal(buf, "inc"))
attra[0] = attra[1] = 0;
- if (!next_token(NULL,buf,NULL,sizeof(buf)))
+ if (!next_token_nr(NULL,buf,NULL,sizeof(buf)))
{
DEBUG(0, ("setmode <filename> <[+|-]rsha>\n"));
return;
safe_strcpy(fname, cur_dir, sizeof(pstring));
safe_strcat(fname, buf, sizeof(pstring));
- while (next_token(NULL,buf,NULL,sizeof(buf))) {
+ while (next_token_nr(NULL,buf,NULL,sizeof(buf))) {
q=buf;
while(*q)
char **argl;
int argcl;
- if (!next_token(NULL,buf,NULL,sizeof(buf)))
+ if (!next_token_nr(NULL,buf,NULL,sizeof(buf)))
{
DEBUG(0,("tar <c|x>[IXbgan] <filename>\n"));
return;
/* The following definitions come from lib/util_str.c */
-void set_first_token(char *ptr);
BOOL next_token(char **ptr,char *buff,char *sep, size_t bufsize);
+BOOL next_token_nr(char **ptr,char *buff,char *sep, size_t bufsize);
+void set_first_token(char *ptr);
char **toktocliplist(int *ctok, char *sep);
int StrCaseCmp(const char *s, const char *t);
int StrnCaseCmp(const char *s, const char *t, size_t n);
int isspace_w( smb_ucs2_t val);
smb_ucs2_t toupper_w( smb_ucs2_t val );
smb_ucs2_t tolower_w( smb_ucs2_t val );
-void set_first_token_w(smb_ucs2_t *ptr);
-BOOL next_token_w(smb_ucs2_t **ptr, smb_ucs2_t *buff, smb_ucs2_t *sep, size_t bufsize);
-smb_ucs2_t **toktocliplist_w(int *ctok, smb_ucs2_t *sep);
int StrCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t);
int StrnCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t, size_t n);
BOOL strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
cmd_argv = NULL;
/* get the first part of the command */
- if (!next_token(&ptr, tok, NULL, sizeof(tok)))
+ if (!next_token_nr(&ptr, tok, NULL, sizeof(tok)))
return False;
do
{
add_chars_to_array(&cmd_argc, &cmd_argv, tok);
}
- while (next_token(NULL, tok, NULL, sizeof(tok)));
+ while (next_token_nr(NULL, tok, NULL, sizeof(tok)));
add_chars_to_array(&cmd_argc, &cmd_argv, NULL);
return False;
}
- if (next_token(NULL, tmp, "\n\r", sizeof(tmp)))
+ if (next_token(&full_keyname, tmp, "\n\r", sizeof(tmp)))
{
fstrcpy(key_name, tmp);
}
extern int DEBUGLEVEL;
-static char *last_ptr=NULL;
-
-void set_first_token(char *ptr)
-{
- last_ptr = ptr;
-}
-
/****************************************************************************
Get the next token from a string, return False if none found
handles double-quotes.
****************************************************************************/
BOOL next_token(char **ptr,char *buff,char *sep, size_t bufsize)
{
- char *s;
- BOOL quoted;
- size_t len=1;
+ char *s;
+ BOOL quoted;
+ size_t len=1;
- if (!ptr) ptr = &last_ptr;
- if (!ptr) return(False);
+ if (!ptr) return(False);
- s = *ptr;
+ s = *ptr;
- /* default to simple separators */
- if (!sep) sep = " \t\n\r";
+ /* default to simple separators */
+ if (!sep) sep = " \t\n\r";
- /* find the first non sep char */
- while(*s && strchr(sep,*s)) s++;
+ /* find the first non sep char */
+ while (*s && strchr(sep,*s)) s++;
+
+ /* nothing left? */
+ if (! *s) return(False);
+
+ /* copy over the token */
+ for (quoted = False; len < bufsize && *s && (quoted || !strchr(sep,*s)); s++) {
+ if (*s == '\"') {
+ quoted = !quoted;
+ } else {
+ len++;
+ *buff++ = *s;
+ }
+ }
+
+ *ptr = (*s) ? s+1 : s;
+ *buff = 0;
+
+ return(True);
+}
- /* nothing left? */
- if (! *s) return(False);
- /* copy over the token */
- for (quoted = False; len < bufsize && *s && (quoted || !strchr(sep,*s)); s++)
- {
- if (*s == '\"') {
- quoted = !quoted;
- } else {
- len++;
- *buff++ = *s;
- }
- }
- *ptr = (*s) ? s+1 : s;
- *buff = 0;
- last_ptr = *ptr;
+/****************************************************************************
+This is like next_token but is not re-entrant and "remembers" the first
+parameter so you can pass NULL. This is useful for user interface code
+but beware the fact that it is not re-entrant!
+****************************************************************************/
+static char *last_ptr=NULL;
- return(True);
+BOOL next_token_nr(char **ptr,char *buff,char *sep, size_t bufsize)
+{
+ BOOL ret;
+ if (!ptr) ptr = &last_ptr;
+
+ ret = next_token(ptr, buff, sep, bufsize);
+ last_ptr = *ptr;
+ return ret;
}
+void set_first_token(char *ptr)
+{
+ last_ptr = ptr;
+}
+
+
/****************************************************************************
Convert list of tokens to array; dependent on above routine.
Uses last_ptr from above - bit of a hack.
****************************************************************************/
char **toktocliplist(int *ctok, char *sep)
{
- char *s=last_ptr;
- int ictok=0;
- char **ret, **iret;
+ char *s=last_ptr;
+ int ictok=0;
+ char **ret, **iret;
- if (!sep) sep = " \t\n\r";
+ if (!sep) sep = " \t\n\r";
- while(*s && strchr(sep,*s)) s++;
+ while(*s && strchr(sep,*s)) s++;
- /* nothing left? */
- if (!*s) return(NULL);
+ /* nothing left? */
+ if (!*s) return(NULL);
- do {
- ictok++;
- while(*s && (!strchr(sep,*s))) s++;
- while(*s && strchr(sep,*s)) *s++=0;
- } while(*s);
-
- *ctok=ictok;
- s=last_ptr;
-
- if (!(ret=iret=malloc(ictok*sizeof(char *)))) return NULL;
-
- while(ictok--) {
- *iret++=s;
- while(*s++);
- while(!*s) s++;
- }
+ do {
+ ictok++;
+ while(*s && (!strchr(sep,*s))) s++;
+ while(*s && strchr(sep,*s)) *s++=0;
+ } while(*s);
+
+ *ctok=ictok;
+ s=last_ptr;
+
+ if (!(ret=iret=malloc(ictok*sizeof(char *)))) return NULL;
+
+ while(ictok--) {
+ *iret++=s;
+ while(*s++);
+ while(!*s) s++;
+ }
- return ret;
+ return ret;
}
return map_table_lower(val);
}
-static smb_ucs2_t *last_ptr = NULL;
-
-void set_first_token_w(smb_ucs2_t *ptr)
-{
- last_ptr = ptr;
-}
-
-/****************************************************************************
- Get the next token from a string, return False if none found
- handles double-quotes.
- Based on a routine by GJC@VILLAGE.COM.
- Extensively modified by Andrew.Tridgell@anu.edu.au
- bufsize is in bytes.
-****************************************************************************/
-
-static smb_ucs2_t sep_list[] = { (smb_ucs2_t)' ', (smb_ucs2_t)'\t', (smb_ucs2_t)'\n', (smb_ucs2_t)'\r', 0};
-static smb_ucs2_t quotechar = (smb_ucs2_t)'\"';
-
-BOOL next_token_w(smb_ucs2_t **ptr, smb_ucs2_t *buff, smb_ucs2_t *sep, size_t bufsize)
-{
- smb_ucs2_t *s;
- BOOL quoted;
- size_t len=1;
-
- /*
- * Convert bufsize to smb_ucs2_t units.
- */
-
- bufsize /= sizeof(smb_ucs2_t);
-
- if (!ptr)
- ptr = &last_ptr;
- if (!ptr)
- return(False);
-
- s = *ptr;
-
- /*
- * Default to simple separators.
- */
-
- if (!sep)
- sep = sep_list;
-
- /*
- * Find the first non sep char.
- */
-
- while(*s && strchr_w(sep,*s))
- s++;
-
- /*
- * Nothing left ?
- */
-
- if (!*s)
- return(False);
-
- /*
- * Copy over the token.
- */
-
- for (quoted = False; len < bufsize && *s && (quoted || !strchr_w(sep,*s)); s++) {
- if (*s == quotechar) {
- quoted = !quoted;
- } else {
- len++;
- *buff++ = *s;
- }
- }
-
- *ptr = (*s) ? s+1 : s;
- *buff = 0;
- last_ptr = *ptr;
-
- return(True);
-}
-
-/****************************************************************************
- Convert list of tokens to array; dependent on above routine.
- Uses last_ptr from above - bit of a hack.
-****************************************************************************/
-
-smb_ucs2_t **toktocliplist_w(int *ctok, smb_ucs2_t *sep)
-{
- smb_ucs2_t *s=last_ptr;
- int ictok=0;
- smb_ucs2_t **ret, **iret;
-
- if (!sep)
- sep = sep_list;
-
- while(*s && strchr_w(sep,*s))
- s++;
-
- /*
- * Nothing left ?
- */
-
- if (!*s)
- return(NULL);
-
- do {
- ictok++;
- while(*s && (!strchr_w(sep,*s)))
- s++;
- while(*s && strchr_w(sep,*s))
- *s++=0;
- } while(*s);
-
- *ctok = ictok;
- s = last_ptr;
-
- if (!(ret=iret=malloc(ictok*sizeof(smb_ucs2_t *))))
- return NULL;
-
- while(ictok--) {
- *iret++=s;
- while(*s++)
- ;
- while(!*s)
- s++;
- }
-
- return ret;
-}
-
/*******************************************************************
Case insensitive string compararison.
********************************************************************/
return num_chars;
}
-/****************************************************************************
- Check if a string is part of a list.
-****************************************************************************/
-
-BOOL in_list_w(smb_ucs2_t *s,smb_ucs2_t *list,BOOL casesensitive)
-{
- wpstring tok;
- smb_ucs2_t *p=list;
-
- if (!list)
- return(False);
-
- while (next_token_w(&p,tok,LIST_SEP_W,sizeof(tok))) {
- if (casesensitive) {
- if (strcmp_w(tok,s) == 0)
- return(True);
- } else {
- if (StrCaseCmp_w(tok,s) == 0)
- return(True);
- }
- }
- return(False);
-}
/* This is used to prevent lots of mallocs of size 2 */
static smb_ucs2_t *null_string = NULL;
memset(cli->inbuf,'\0',smb_size);
if (size > 0xFFFF)
- set_message(cli->outbuf,14,size,True);
+ set_message(cli->outbuf,14,0,True);
else
- set_message(cli->outbuf,12,size,True);
+ set_message(cli->outbuf,12,0,True);
CVAL(cli->outbuf,smb_com) = SMBwriteX;
SSVAL(cli->outbuf,smb_tid,cli->cnum);
p = smb_base(cli->outbuf) + SVAL(cli->outbuf,smb_vwv11);
memcpy(p, buf, size);
+ cli_setup_bcc(cli, p+size);
SSVAL(cli->outbuf,smb_mid,cli->mid + i);
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0',smb_size);
- set_message(cli->outbuf,5, 3 + size,True);
+ set_message(cli->outbuf,5, 0,True);
CVAL(cli->outbuf,smb_com) = SMBwrite;
SSVAL(cli->outbuf,smb_tid,cli->cnum);
p = smb_buf(cli->outbuf);
*p++ = 1;
- SSVAL(p, 0, size);
- memcpy(p+2, buf, size);
+ SSVAL(p, 0, size); p += 2;
+ memcpy(p, buf, size); p += size;
+
+ cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (!cli_receive_smb(cli)) {
lib/util_str.c as I really don't want to have to link in any other
objects if I can possibly avoid it. */
-static char *last_ptr = NULL;
-
-BOOL next_token(char **ptr, char *buff, char *sep, size_t bufsize)
+BOOL next_token(char **ptr,char *buff,char *sep, size_t bufsize)
{
char *s;
BOOL quoted;
size_t len=1;
-
- if (!ptr) ptr = &last_ptr;
+
if (!ptr) return(False);
-
+
s = *ptr;
-
+
/* default to simple separators */
if (!sep) sep = " \t\n\r";
-
+
/* find the first non sep char */
- while(*s && strchr(sep,*s)) s++;
-
+ while (*s && strchr(sep,*s)) s++;
+
/* nothing left? */
if (! *s) return(False);
-
+
/* copy over the token */
- for (quoted = False;
- len < bufsize && *s && (quoted || !strchr(sep,*s));
- s++) {
-
+ for (quoted = False; len < bufsize && *s && (quoted || !strchr(sep,*s)); s++) {
if (*s == '\"') {
quoted = !quoted;
} else {
*buff++ = *s;
}
}
-
+
*ptr = (*s) ? s+1 : s;
*buff = 0;
- last_ptr = *ptr;
-
+
return(True);
}
+
/* Fill a pwent structure from a winbindd_response structure. We use
the static data passed to us by libc to put strings and stuff in.
Return NSS_STATUS_TRYAGAIN if we run out of memory. */
DEBUG(5, ("cmd_reg_enum: smb_cli->fd:%d\n", smb_cli->fd));
- if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname)))
+ if (!next_token_nr(NULL, full_keyname, NULL, sizeof(full_keyname)))
{
fprintf(out_hnd, "regenum <key_name>\n");
return;
DEBUG(5, ("cmd_reg_enum: smb_cli->fd:%d\n", smb_cli->fd));
- if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname)))
+ if (!next_token_nr(NULL, full_keyname, NULL, sizeof(full_keyname)))
{
fprintf(out_hnd, "regquery key_name\n");
return;
DEBUG(5, ("cmd_reg_create_val: smb_cli->fd:%d\n", smb_cli->fd));
- if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname)))
+ if (!next_token_nr(NULL, full_keyname, NULL, sizeof(full_keyname)))
{
fprintf(out_hnd, "regcreate <val_name> <val_type> <val>\n");
return;
return;
}
- if (!next_token(NULL, tmp, NULL, sizeof(tmp)))
+ if (!next_token_nr(NULL, tmp, NULL, sizeof(tmp)))
{
fprintf(out_hnd, "regcreate <val_name> <val_type (1|4)> <val>\n");
return;
return;
}
- if (!next_token(NULL, tmp, NULL, sizeof(tmp)))
+ if (!next_token_nr(NULL, tmp, NULL, sizeof(tmp)))
{
fprintf(out_hnd, "regcreate <val_name> <val_type (1|4)> <val>\n");
return;
DEBUG(5, ("cmd_reg_delete_val: smb_cli->fd:%d\n", smb_cli->fd));
- if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname)))
+ if (!next_token_nr(NULL, full_keyname, NULL, sizeof(full_keyname)))
{
fprintf(out_hnd, "regdelete <val_name>\n");
return;
DEBUG(5, ("cmd_reg_delete_key: smb_cli->fd:%d\n", smb_cli->fd));
- if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname)))
+ if (!next_token_nr(NULL, full_keyname, NULL, sizeof(full_keyname)))
{
fprintf(out_hnd, "regdeletekey <key_name>\n");
return;
DEBUG(5, ("cmd_reg_create_key: smb_cli->fd:%d\n", smb_cli->fd));
- if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname)))
+ if (!next_token_nr(NULL, full_keyname, NULL, sizeof(full_keyname)))
{
fprintf(out_hnd, "regcreate <key_name> [key_class]\n");
return;
return;
}
- if (!next_token(NULL, key_class, NULL, sizeof(key_class)))
+ if (!next_token_nr(NULL, key_class, NULL, sizeof(key_class)))
{
memset(key_class, 0, sizeof(key_class));
}
DEBUG(5, ("cmd_reg_get_key_sec: smb_cli->fd:%d\n", smb_cli->fd));
- if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname)))
+ if (!next_token_nr(NULL, full_keyname, NULL, sizeof(full_keyname)))
{
fprintf(out_hnd, "reggetsec <key_name>\n");
return;
DEBUG(5, ("cmd_reg_get_key_sec: smb_cli->fd:%d\n", smb_cli->fd));
- if (!next_token(NULL, full_keyname, NULL, sizeof(full_keyname)))
+ if (!next_token_nr(NULL, full_keyname, NULL, sizeof(full_keyname)))
{
fprintf(out_hnd, "reggetsec <key_name>\n");
return;
fstrcat(dest_wks, info->dest_host);
strupper(dest_wks);
- if (next_token(NULL, tmp, NULL, sizeof(tmp)))
+ if (next_token_nr(NULL, tmp, NULL, sizeof(tmp)))
{
info_level = (uint32)strtol(tmp, (char**)NULL, 10);
}
pstring buf;
int argc = 1, i;
- next_token(&p, buf, " ", sizeof(buf));
+ next_token_nr(&p, buf, " ", sizeof(buf));
/* Count number of arguments first time through the loop then
allocate memory and strdup them. */
again:
- while(next_token(NULL, buf, " ", sizeof(buf))) {
+ while(next_token_nr(NULL, buf, " ", sizeof(buf))) {
if (argv) {
argv[argc] = strdup(buf);
}
}
p = cmd;
- next_token(&p, buf, " ", sizeof(buf));
+ next_token_nr(&p, buf, " ", sizeof(buf));
argv[0] = strdup(buf);
argc = 1;
if (cmd[strlen(cmd) - 1] == '\n')
cmd[strlen(cmd) - 1] = '\0';
- if (!next_token(&p, buf, " ", sizeof(buf))) {
+ if (!next_token_nr(&p, buf, " ", sizeof(buf))) {
return 0;
}
char *outbuf = OutBuffer;
char *inbuf = blr->inbuf;
ssize_t nread = -1;
- char *data;
+ char *data, *p;
int outsize = 0;
SMB_OFF_T startpos;
size_t numtoread;
}
construct_reply_common(inbuf, outbuf);
- outsize = set_message(outbuf,5,3,True);
+ outsize = set_message(outbuf,5,0,True);
outsize += nread;
SSVAL(outbuf,smb_vwv0,nread);
SSVAL(outbuf,smb_vwv5,nread+3);
- SSVAL(smb_buf(outbuf),1,nread);
+ p = smb_buf(outbuf);
+ *p++ = 1;
+ SSVAL(p,0,nread); p += 2;
+ set_message_end(outbuf, p+nread);
DEBUG(3, ( "process_lockread file = %s, fnum=%d num=%d nread=%d\n",
fsp->fsp_name, fsp->fnum, (int)numtoread, (int)nread ) );
/* Only numeric form accepted for flags at present */
- if (!(next_token(NULL, tok, "/", sizeof(fstring)) &&
+ if (!(next_token(&p, tok, "/", sizeof(fstring)) &&
sscanf(tok, "%i", &aflags))) {
return False;
}
- if (!next_token(NULL, tok, "/", sizeof(fstring))) {
+ if (!next_token(&p, tok, "/", sizeof(fstring))) {
return False;
}