if (ISDOTDOT(file)) file = ".";
- return ms_fnmatch_protocol(pattern, file, cli->transport->negotiate.protocol)==0;
+ return ms_fnmatch_protocol(
+ pattern, file, cli->transport->negotiate.protocol, false)==0;
}
static char *reg_test(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *pattern, const char *long_name, const char *short_name)
*share = 0;
share++;
- cli_credentials_set_workstation(cmdline_credentials, "masktest", CRED_SPECIFIED);
+ cli_credentials_set_workstation(popt_get_cmdline_credentials(),
+ "masktest", CRED_SPECIFIED);
status = smbcli_full_connection(NULL, &c,
server,
ports,
share, NULL,
socket_options,
- cmdline_credentials, resolve_ctx, ev,
+ popt_get_cmdline_credentials(),
+ resolve_ctx, ev,
options, session_options,
gensec_settings);
*long_name = strlower_talloc(mem_ctx, last_hit.long_name);
}
- if (*short_name == '\0') {
+ if (*short_name[0] == '\0') {
*short_name = talloc_strdup(mem_ctx, *long_name);
}
}
finished:
smbcli_rmdir(cli->tree, "\\masktest");
- talloc_free(mem_ctx);
}
/****************************************************************************
main program
****************************************************************************/
- int main(int argc,char *argv[])
+int main(int argc, const char *argv[])
{
char *share;
struct smbcli_state *cli;
poptContext pc;
int argc_new, i;
char **argv_new;
- TALLOC_CTX *mem_ctx;
+ TALLOC_CTX *mem_ctx = NULL;
enum {OPT_UNCLIST=1000};
struct poptOption long_options[] = {
POPT_AUTOHELP
POPT_COMMON_CONNECTION
POPT_COMMON_CREDENTIALS
POPT_COMMON_VERSION
- { NULL }
+ {0}
};
setlinebuf(stdout);
seed = time(NULL);
- pc = poptGetContext("locktest", argc, (const char **) argv, long_options,
+ mem_ctx = talloc_named_const(NULL, 0, "masktest_ctx");
+ if (mem_ctx == NULL) {
+ exit(1);
+ }
+
+ pc = poptGetContext("locktest", argc, argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
poptSetOtherOptionHelp(pc, "<unc>");
if (!(argc_new >= 2)) {
usage(pc);
+ talloc_free(mem_ctx);
exit(1);
}
lp_ctx = cmdline_lp_ctx;
- mem_ctx = talloc_autofree_context();
-
ev = s4_event_context_init(mem_ctx);
gensec_init();
lpcfg_gensec_settings(mem_ctx, lp_ctx));
if (!cli) {
DEBUG(0,("Failed to connect to %s\n", share));
+ talloc_free(mem_ctx);
exit(1);
}
test_mask(argc_new-1, argv_new+1, mem_ctx, cli);
+ poptFreeContext(pc);
+ talloc_free(mem_ctx);
return(0);
}