mirror of
https://github.com/samba-team/samba.git
synced 2025-12-12 12:23:50 +03:00
Remove tok pstring from util_str.c
Do we even make rpctorture anymore ? Jeremy.
This commit is contained in:
@@ -2053,7 +2053,8 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx,
|
|||||||
const char *str;
|
const char *str;
|
||||||
char *s;
|
char *s;
|
||||||
int num, lsize;
|
int num, lsize;
|
||||||
pstring tok;
|
char *tok;
|
||||||
|
TALLOC_CTX *frame = NULL;
|
||||||
|
|
||||||
if (!string || !*string)
|
if (!string || !*string)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -2072,7 +2073,8 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx,
|
|||||||
list = NULL;
|
list = NULL;
|
||||||
|
|
||||||
str = s;
|
str = s;
|
||||||
while (next_token(&str, tok, sep, sizeof(tok))) {
|
frame = talloc_stackframe();
|
||||||
|
while (next_token_talloc(frame, &str, &tok, sep)) {
|
||||||
if (num == lsize) {
|
if (num == lsize) {
|
||||||
lsize += S_LIST_ABS;
|
lsize += S_LIST_ABS;
|
||||||
if (mem_ctx) {
|
if (mem_ctx) {
|
||||||
@@ -2094,6 +2096,7 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx,
|
|||||||
} else {
|
} else {
|
||||||
SAFE_FREE(s);
|
SAFE_FREE(s);
|
||||||
}
|
}
|
||||||
|
TALLOC_FREE(frame);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
list = rlist;
|
list = rlist;
|
||||||
@@ -2116,12 +2119,15 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx,
|
|||||||
} else {
|
} else {
|
||||||
SAFE_FREE(s);
|
SAFE_FREE(s);
|
||||||
}
|
}
|
||||||
|
TALLOC_FREE(frame);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TALLOC_FREE(frame);
|
||||||
|
|
||||||
if (mem_ctx) {
|
if (mem_ctx) {
|
||||||
TALLOC_FREE(s);
|
TALLOC_FREE(s);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
#define REGISTER 0
|
#define REGISTER 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern pstring global_myname;
|
|
||||||
|
|
||||||
extern file_info def_finfo;
|
extern file_info def_finfo;
|
||||||
|
|
||||||
#define CNV_LANG(s) dos2unix_format(s,False)
|
#define CNV_LANG(s) dos2unix_format(s,False)
|
||||||
@@ -35,7 +33,7 @@ struct cli_state *smb_cli = &smbcli;
|
|||||||
|
|
||||||
FILE *out_hnd;
|
FILE *out_hnd;
|
||||||
|
|
||||||
static pstring password; /* local copy only, if one is entered */
|
static char *password; /* local copy only, if one is entered */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
initialise smb client structure
|
initialise smb client structure
|
||||||
@@ -85,7 +83,6 @@ static void rpcclient_stop(void)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void run_enums_test(int num_ops, struct client_info *cli_info, struct cli_state *cli)
|
void run_enums_test(int num_ops, struct client_info *cli_info, struct cli_state *cli)
|
||||||
{
|
{
|
||||||
pstring cmd;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* establish connections. nothing to stop these being re-established. */
|
/* establish connections. nothing to stop these being re-established. */
|
||||||
@@ -110,8 +107,7 @@ void run_enums_test(int num_ops, struct client_info *cli_info, struct cli_state
|
|||||||
|
|
||||||
if (password[0] != 0)
|
if (password[0] != 0)
|
||||||
{
|
{
|
||||||
slprintf(cmd, sizeof(cmd)-1, "1");
|
set_first_token("1");
|
||||||
set_first_token(cmd);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -129,7 +125,6 @@ void run_enums_test(int num_ops, struct client_info *cli_info, struct cli_state
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void run_ntlogin_test(int num_ops, struct client_info *cli_info, struct cli_state *cli)
|
void run_ntlogin_test(int num_ops, struct client_info *cli_info, struct cli_state *cli)
|
||||||
{
|
{
|
||||||
pstring cmd;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* establish connections. nothing to stop these being re-established. */
|
/* establish connections. nothing to stop these being re-established. */
|
||||||
@@ -145,10 +140,12 @@ void run_ntlogin_test(int num_ops, struct client_info *cli_info, struct cli_stat
|
|||||||
|
|
||||||
for (i = 0; i < num_ops; i++)
|
for (i = 0; i < num_ops; i++)
|
||||||
{
|
{
|
||||||
slprintf(cmd, sizeof(cmd)-1, "%s %s", cli->user_name, password);
|
char *cmd;
|
||||||
|
if (asprintf(&cmd, "%s %s", cli->user_name, password) > 0) {
|
||||||
set_first_token(cmd);
|
set_first_token(cmd);
|
||||||
|
|
||||||
cmd_netlogon_login_test(cli_info);
|
cmd_netlogon_login_test(cli_info);
|
||||||
|
SAFE_FREE(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rpcclient_stop();
|
rpcclient_stop();
|
||||||
@@ -218,13 +215,12 @@ enum client_action
|
|||||||
int opt;
|
int opt;
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
extern int optind;
|
extern int optind;
|
||||||
pstring term_code;
|
|
||||||
bool got_pass = False;
|
bool got_pass = False;
|
||||||
char *cmd_str="";
|
char *cmd_str="";
|
||||||
enum client_action cli_action = CLIENT_NONE;
|
enum client_action cli_action = CLIENT_NONE;
|
||||||
int nprocs = 1;
|
int nprocs = 1;
|
||||||
int numops = 100;
|
int numops = 100;
|
||||||
pstring logfile;
|
char *logfile;
|
||||||
TALLOC_CTX *frame = talloc_stackframe();
|
TALLOC_CTX *frame = talloc_stackframe();
|
||||||
|
|
||||||
struct client_info cli_info;
|
struct client_info cli_info;
|
||||||
@@ -233,12 +229,6 @@ enum client_action
|
|||||||
|
|
||||||
rpcclient_init();
|
rpcclient_init();
|
||||||
|
|
||||||
#ifdef KANJI
|
|
||||||
pstrcpy(term_code, KANJI);
|
|
||||||
#else /* KANJI */
|
|
||||||
*term_code = 0;
|
|
||||||
#endif /* KANJI */
|
|
||||||
|
|
||||||
if (!lp_load(dyn_CONFIGFILE,True, False, False, True))
|
if (!lp_load(dyn_CONFIGFILE,True, False, False, True))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
|
fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
|
||||||
@@ -290,13 +280,11 @@ enum client_action
|
|||||||
|
|
||||||
setup_logging(pname, True);
|
setup_logging(pname, True);
|
||||||
|
|
||||||
global_myname = get_myname(global_myname);
|
password = talloc_strdup(frame, "");
|
||||||
if (!global_myname) {
|
if (!password) {
|
||||||
fprintf(stderr, "Failed to get my hostname.\n");
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
password[0] = 0;
|
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
usage(pname);
|
usage(pname);
|
||||||
@@ -332,8 +320,10 @@ enum client_action
|
|||||||
if (argc > 1 && (*argv[1] != '-'))
|
if (argc > 1 && (*argv[1] != '-'))
|
||||||
{
|
{
|
||||||
got_pass = True;
|
got_pass = True;
|
||||||
pstrcpy(password,argv[1]);
|
password = talloc_strdup(frame, argv[1]);
|
||||||
memset(argv[1],'X',strlen(argv[1]));
|
if (!password) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
@@ -382,9 +372,11 @@ enum client_action
|
|||||||
if ((lp=strchr_m(smb_cli->user_name,'%')))
|
if ((lp=strchr_m(smb_cli->user_name,'%')))
|
||||||
{
|
{
|
||||||
*lp = 0;
|
*lp = 0;
|
||||||
pstrcpy(password,lp+1);
|
password = talloc_strdup(frame, lp+1);
|
||||||
|
if (!password) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
got_pass = True;
|
got_pass = True;
|
||||||
memset(strchr_m(optarg,'%')+1,'X',strlen(password));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -425,7 +417,7 @@ enum client_action
|
|||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
{
|
{
|
||||||
fstrcpy(global_myname, optarg);
|
set_global_myname(optarg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,9 +432,10 @@ enum client_action
|
|||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
{
|
{
|
||||||
slprintf(logfile, sizeof(logfile)-1,
|
if (asprintf(&logfile, "%s.client",optarg) > 0) {
|
||||||
"%s.client",optarg);
|
|
||||||
lp_set_logfile(logfile);
|
lp_set_logfile(logfile);
|
||||||
|
SAFE_FREE(logfile);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,12 +459,6 @@ enum client_action
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 't':
|
|
||||||
{
|
|
||||||
pstrcpy(term_code, optarg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
usage(pname);
|
usage(pname);
|
||||||
@@ -487,8 +474,8 @@ enum client_action
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
strupper_m(global_myname);
|
fstrcpy(cli_info.myhostname, global_myname());
|
||||||
fstrcpy(cli_info.myhostname, global_myname);
|
strupper_m(cli_info.myhostname);
|
||||||
|
|
||||||
DEBUG(3,("%s client started (version %s)\n",current_timestring(False),SAMBA_VERSION_STRING));
|
DEBUG(3,("%s client started (version %s)\n",current_timestring(False),SAMBA_VERSION_STRING));
|
||||||
|
|
||||||
@@ -525,7 +512,10 @@ enum client_action
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *pwd = getpass("Enter Password:");
|
char *pwd = getpass("Enter Password:");
|
||||||
safe_strcpy(password, pwd, sizeof(password));
|
password = talloc_strdup(frame, pwd);
|
||||||
|
if (!password) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
pwd_make_lm_nt_16(&(smb_cli->pwd), password); /* generate 16 byte hashes */
|
pwd_make_lm_nt_16(&(smb_cli->pwd), password); /* generate 16 byte hashes */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user