return NT_STATUS_OK;
}
- if (!lp_load(argv[1], False, True, False, True)) {
+ if (!lp_load_with_shares(argv[1])) {
printf("Error loading \"%s\"\n", argv[1]);
return NT_STATUS_OK;
}
static NTSTATUS do_cmd(struct vfs_state *vfs, struct cmd_set *cmd_entry, char *cmd)
{
const char *p = cmd;
- char **argv = NULL;
+ const char **argv = NULL;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
char *buf;
TALLOC_CTX *mem_ctx = talloc_stackframe();
- int argc = 0, i;
+ int argc = 0;
/* Count number of arguments first time through the loop then
allocate memory and strdup them. */
again:
while(next_token_talloc(mem_ctx, &p, &buf, " ")) {
if (argv) {
- argv[argc] = SMB_STRDUP(buf);
+ argv[argc] = talloc_strdup(argv, buf);
}
argc++;
}
if (!argv) {
/* Create argument list */
- argv = SMB_MALLOC_ARRAY(char *, argc);
- memset(argv, 0, sizeof(char *) * argc);
-
- if (!argv) {
+ argv = talloc_zero_array(mem_ctx, const char *, argc);
+ if (argv == NULL) {
fprintf(stderr, "out of memory\n");
result = NT_STATUS_NO_MEMORY;
goto done;
/* Cleanup */
if (argv) {
- for (i = 0; i < argc; i++)
- SAFE_FREE(argv[i]);
-
- SAFE_FREE(argv);
+ char **_argv = discard_const_p(char *, argv);
+ TALLOC_FREE(_argv);
+ argv = NULL;
}
if (memreports != 0) {
}
}
+static void vfstest_exit_server(const char * const reason) _NORETURN_;
static void vfstest_exit_server(const char * const reason)
{
DEBUG(3,("Server exit (%s)\n", (reason ? reason : "")));
exit(0);
}
+static void vfstest_exit_server_cleanly(const char * const reason) _NORETURN_;
static void vfstest_exit_server_cleanly(const char * const reason)
{
vfstest_exit_server("normal exit");
struct vfs_state *vfs)
{
struct smb_request *result;
+ uint8_t *inbuf;
result = talloc_zero(mem_ctx, struct smb_request);
if (result == NULL) {
result->sconn = vfs->conn->sconn;
result->mid = ++vfs->mid;
- result->inbuf = talloc_array(result, uint8_t, smb_size);
- if (result->inbuf == NULL) {
+ inbuf = talloc_array(result, uint8_t, smb_size);
+ if (inbuf == NULL) {
goto fail;
}
- SSVAL(result->inbuf, smb_mid, result->mid);
- smb_setlen(result->inbuf, smb_size-4);
+ SSVAL(inbuf, smb_mid, result->mid);
+ smb_setlen(inbuf, smb_size-4);
+ result->inbuf = inbuf;
return result;
fail:
TALLOC_FREE(result);
/* Main function */
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
{
char *cmdstr = NULL;
struct cmd_set **cmd_set;
char *filename = NULL;
char cwd[MAXPATHLEN];
TALLOC_CTX *frame = talloc_stackframe();
- struct tevent_context *ev = samba_tevent_context_init(NULL);
+ struct tevent_context *ev;
struct auth_session_info *session_info = NULL;
NTSTATUS status = NT_STATUS_OK;
.exit_server_cleanly = vfstest_exit_server_cleanly,
};
- load_case_tables();
+ smb_init_locale();
setlinebuf(stdout);
- pc = poptGetContext("vfstest", argc, (const char **) argv,
- long_options, 0);
+ pc = poptGetContext("vfstest", argc, argv, long_options, 0);
while(poptGetNextOpt(pc) != -1);
/* some basic initialization stuff */
sec_init();
- init_guest_info();
+ init_guest_session_info(frame);
locking_init();
- serverid_parent_init(NULL);
vfs = talloc_zero(NULL, struct vfs_state);
if (vfs == NULL) {
return 1;
return 1;
}
+ ev = server_event_context();
+
status = create_conn_struct(vfs,
ev,
- messaging_init(vfs, ev),
+ server_messaging_context(),
&vfs->conn,
-1,
getcwd(cwd, sizeof(cwd)),
vfs->conn->share_access = FILE_GENERIC_ALL;
vfs->conn->read_only = false;
- serverid_register(messaging_server_id(vfs->conn->sconn->msg_ctx), 0);
file_init(vfs->conn->sconn);
for (i=0; i < 1024; i++)
vfs->files[i] = NULL;