#include "../lib/util/tevent_ntstatus.h"
#include "util_tdb.h"
#include "../libcli/smb/read_smb.h"
+#include "../libcli/smb/smbXcli_base.h"
extern char *optarg;
extern int optind;
static double create_procs(bool (*fn)(int), bool *result);
-
-/* return a pointer to a anonymous shared memory segment of size "size"
- which will persist across fork() but will disappear when all processes
- exit
-
- The memory is not zeroed
-
- This function uses system5 shared memory. It takes advantage of a property
- that the memory is not destroyed if it is attached when the id is removed
- */
-void *shm_setup(int size)
-{
- int shmid;
- void *ret;
-
-#ifdef __QNXNTO__
- shmid = shm_open("private", O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
- if (shmid == -1) {
- printf("can't get shared memory\n");
- exit(1);
- }
- shm_unlink("private");
- if (ftruncate(shmid, size) == -1) {
- printf("can't set shared memory size\n");
- exit(1);
- }
- ret = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, shmid, 0);
- if (ret == MAP_FAILED) {
- printf("can't map shared memory\n");
- exit(1);
- }
-#else
- shmid = shmget(IPC_PRIVATE, size, S_IRUSR | S_IWUSR);
- if (shmid == -1) {
- printf("can't get shared memory\n");
- exit(1);
- }
- ret = (void *)shmat(shmid, 0, 0);
- if (!ret || ret == (void *)-1) {
- printf("can't attach to shared memory\n");
- return NULL;
- }
- /* the following releases the ipc, but note that this process
- and all its children will still have access to the memory, its
- just that the shmid is no longer valid for other shm calls. This
- means we don't leave behind lots of shm segments after we exit
-
- See Stevens "advanced programming in unix env" for details
- */
- shmctl(shmid, IPC_RMID, 0);
-#endif
-
- return ret;
-}
-
/********************************************************************
Ensure a connection is encrypted.
********************************************************************/
cli = current_cli;
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
ret = rw_torture(cli);
if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
return False;
}
- cli_sockopt(cli1, sockops);
- cli_sockopt(cli2, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
+ smbXcli_conn_set_sockopt(cli2->conn, sockops);
printf("starting readwritetest\n");
cli = current_cli;
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
printf("run_readwritemulti: fname %s\n", randomfname);
test = rw_torture3(cli, randomfname);
if (!torture_open_connection(&cli1, 0)) {
return False;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
memset(buf,'\0',sizeof(buf));
printf("starting readwritelarge_internal\n");
nbio_id = client;
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
nb_setup(cli);
if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
return False;
}
- cli_sockopt(cli1, sockops);
- cli_sockopt(cli2, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
+ smbXcli_conn_set_sockopt(cli2->conn, sockops);
printf("starting locktest1\n");
if (!torture_open_connection(&cli, 0)) {
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
printf("starting tcontest\n");
if (!torture_open_connection(&cli, 0)) {
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
printf("starting tcon2 test\n");
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
printf("starting locktest2\n");
if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
return False;
}
- cli_sockopt(cli1, sockops);
- cli_sockopt(cli2, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
+ smbXcli_conn_set_sockopt(cli2->conn, sockops);
printf("starting locktest3\n");
return False;
}
- cli_sockopt(cli1, sockops);
- cli_sockopt(cli2, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
+ smbXcli_conn_set_sockopt(cli2->conn, sockops);
printf("starting locktest4\n");
return False;
}
- cli_sockopt(cli1, sockops);
- cli_sockopt(cli2, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
+ smbXcli_conn_set_sockopt(cli2->conn, sockops);
printf("starting locktest5\n");
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
printf("starting locktest6\n");
return False;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
printf("starting locktest7\n");
return False;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
printf("starting locktest8\n");
static void alarm_handler_parent(int dummy)
{
- cli_state_disconnect(alarm_cli);
+ smbXcli_conn_disconnect(alarm_cli->conn, NT_STATUS_OK);
}
static void do_local_lock(int read_fd, int write_fd)
return false;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
status = cli_openx(cli1, fname, O_RDWR, DENY_NONE,
&fnum);
if (!torture_open_connection(&cli1, 0) || !torture_open_connection(&cli2, 1)) {
return False;
}
- cli_sockopt(cli1, sockops);
- cli_sockopt(cli2, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
+ smbXcli_conn_set_sockopt(cli2->conn, sockops);
printf("starting fdpasstest\n");
if (!torture_open_connection(&cli, 0))
return False;
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
if (!torture_cli_session_setup2(cli, &new_vuid))
return False;
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
printf("starting unlink test\n");
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
for (i=0; i<0x11000; i++) {
slprintf(fname,sizeof(fname)-1,"\\maxfid.%d.%d", i,(int)getpid());
for (i=0;i<50000;i++) {
struct tevent_req *req;
- req = cli_negprot_send(ev, ev, cli, PROTOCOL_NT1);
+ req = smbXcli_negprot_send(ev, ev, cli->conn, cli->timeout,
+ PROTOCOL_CORE, PROTOCOL_NT1);
if (req == NULL) {
TALLOC_FREE(ev);
return false;
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
cli1->use_oplocks = True;
size_t nread;
NTSTATUS status;
- shared_correct = (volatile bool *)shm_setup(sizeof(bool));
+ shared_correct = (volatile bool *)anonymous_shared_allocate(sizeof(bool));
*shared_correct = True;
use_level_II_oplocks = True;
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_sockopt(cli1, sockops);
- cli_sockopt(cli2, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
+ smbXcli_conn_set_sockopt(cli2->conn, sockops);
status = cli_openx(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
&fnum1);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_unlink(cli1, fname_ln, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_sockopt(cli1, sockops);
- cli_sockopt(cli2, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
+ smbXcli_conn_set_sockopt(cli2->conn, sockops);
/* Create the file. */
status = cli_openx(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE,
const char *fname = "\\delete.file";
uint16_t fnum1 = (uint16_t)-1;
uint16_t fnum2 = (uint16_t)-1;
- bool correct = True;
+ bool correct = false;
NTSTATUS status;
printf("starting delete test\n");
return False;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
/* Test 1 - this should delete the file on close. */
FILE_DELETE_ON_CLOSE, 0, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[1] open of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[1] close failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
- if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum1))) {
+ status = cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
+ if (NT_STATUS_IS_OK(status)) {
printf("[1] open of %s succeeded (should fail)\n", fname);
- correct = False;
goto fail;
}
FILE_OVERWRITE_IF, 0, 0, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[2] open of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
status = cli_nt_delete_on_close(cli1, fnum1, true);
if (!NT_STATUS_IS_OK(status)) {
printf("[2] setting delete_on_close failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[2] close failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
- if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+ status = cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+ if (NT_STATUS_IS_OK(status)) {
printf("[2] open of %s succeeded should have been deleted on close !\n", fname);
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[2] close failed (%s)\n", nt_errstr(status));
- correct = False;
- goto fail;
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- } else
- printf("second delete on close test succeeded.\n");
+ goto fail;
+ }
+
+ printf("second delete on close test succeeded.\n");
/* Test 3 - ... */
cli_setatr(cli1, fname, 0, 0);
FILE_OVERWRITE_IF, 0, 0, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[3] open - 1 of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
/* This should fail with a sharing violation - open for delete is only compatible
with SHARE_DELETE. */
- if (NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0, 0, &fnum2))) {
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_OPEN, 0, 0, &fnum2);
+ if (NT_STATUS_IS_OK(status)) {
printf("[3] open - 2 of %s succeeded - should have failed.\n", fname);
- correct = False;
goto fail;
}
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
FILE_OPEN, 0, 0, &fnum2);
if (!NT_STATUS_IS_OK(status)) {
- printf("[3] open - 2 of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
+ printf("[3] open - 3 of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
}
status = cli_nt_delete_on_close(cli1, fnum1, true);
if (!NT_STATUS_IS_OK(status)) {
printf("[3] setting delete_on_close failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[3] close 1 failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum2);
if (!NT_STATUS_IS_OK(status)) {
printf("[3] close 2 failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
/* This should fail - file should no longer be there. */
- if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+ status = cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+ if (NT_STATUS_IS_OK(status)) {
printf("[3] open of %s succeeded should have been deleted on close !\n", fname);
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[3] close failed (%s)\n", nt_errstr(status));
}
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- correct = False;
goto fail;
- } else
- printf("third delete on close test succeeded.\n");
+ }
+
+ printf("third delete on close test succeeded.\n");
/* Test 4 ... */
cli_setatr(cli1, fname, 0, 0);
FILE_OVERWRITE_IF, 0, 0, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[4] open of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
FILE_OPEN, 0, 0, &fnum2);
if (!NT_STATUS_IS_OK(status)) {
printf("[4] open - 2 of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum2);
if (!NT_STATUS_IS_OK(status)) {
printf("[4] close - 1 failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
status = cli_nt_delete_on_close(cli1, fnum1, true);
if (!NT_STATUS_IS_OK(status)) {
printf("[4] setting delete_on_close failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
/* This should fail - no more opens once delete on close set. */
- if (NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
- FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN, 0, 0, &fnum2))) {
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OPEN, 0, 0, &fnum2);
+ if (NT_STATUS_IS_OK(status)) {
printf("[4] open - 3 of %s succeeded ! Should have failed.\n", fname );
- correct = False;
goto fail;
- } else
- printf("fourth delete on close test succeeded.\n");
+ }
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[4] close - 2 failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
+ printf("fourth delete on close test succeeded.\n");
+
/* Test 5 ... */
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
status = cli_openx(cli1, fname, O_RDWR|O_CREAT, DENY_NONE, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[5] open of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
/* This should fail - only allowed on NT opens with DELETE access. */
- if (NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
+ status = cli_nt_delete_on_close(cli1, fnum1, true);
+ if (NT_STATUS_IS_OK(status)) {
printf("[5] setting delete_on_close on OpenX file succeeded - should fail !\n");
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
- printf("[5] close - 2 failed (%s)\n", nt_errstr(status));
- correct = False;
+ printf("[5] close failed (%s)\n", nt_errstr(status));
goto fail;
}
if (!NT_STATUS_IS_OK(status)) {
printf("[6] open of %s failed (%s)\n", fname,
nt_errstr(status));
- correct = False;
goto fail;
}
/* This should fail - only allowed on NT opens with DELETE access. */
- if (NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
+ status = cli_nt_delete_on_close(cli1, fnum1, true);
+ if (NT_STATUS_IS_OK(status)) {
printf("[6] setting delete_on_close on file with no delete access succeeded - should fail !\n");
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
- printf("[6] close - 2 failed (%s)\n", nt_errstr(status));
- correct = False;
+ printf("[6] close failed (%s)\n", nt_errstr(status));
goto fail;
}
0, 0, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[7] open of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
+ status = cli_nt_delete_on_close(cli1, fnum1, true);
+ if (!NT_STATUS_IS_OK(status)) {
printf("[7] setting delete_on_close on file failed !\n");
- correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, false))) {
+ status = cli_nt_delete_on_close(cli1, fnum1, false);
+ if (!NT_STATUS_IS_OK(status)) {
printf("[7] unsetting delete_on_close on file failed !\n");
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
- printf("[7] close - 2 failed (%s)\n", nt_errstr(status));
- correct = False;
+ printf("[7] close - 1 failed (%s)\n", nt_errstr(status));
goto fail;
}
/* This next open should succeed - we reset the flag. */
status = cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
- printf("[5] open of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
+ printf("[7] open of %s failed (%s)\n", fname, nt_errstr(status));
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[7] close - 2 failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
printf("seventh delete on close test succeeded.\n");
- /* Test 7 ... */
+ /* Test 8 ... */
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
if (!torture_open_connection(&cli2, 1)) {
printf("[8] failed to open second connection.\n");
- correct = False;
goto fail;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
status = cli_ntcreate(cli1, fname, 0,
FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
FILE_OVERWRITE_IF, 0, 0, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[8] open 1 of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
FILE_OPEN, 0, 0, &fnum2);
if (!NT_STATUS_IS_OK(status)) {
printf("[8] open 2 of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
- if (!NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
+ status = cli_nt_delete_on_close(cli1, fnum1, true);
+ if (!NT_STATUS_IS_OK(status)) {
printf("[8] setting delete_on_close on file failed !\n");
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[8] close - 1 failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
status = cli_close(cli2, fnum2);
if (!NT_STATUS_IS_OK(status)) {
printf("[8] close - 2 failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
if (NT_STATUS_IS_OK(status)) {
printf("[8] open of %s succeeded should have been deleted on close !\n", fname);
goto fail;
- correct = False;
- } else
- printf("eighth delete on close test succeeded.\n");
+ }
+
+ printf("eighth delete on close test succeeded.\n");
+
+ /* Test 9 ... */
/* This should fail - we need to set DELETE_ACCESS. */
- if (NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0,FILE_READ_DATA|FILE_WRITE_DATA,
- FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE, FILE_OVERWRITE_IF, FILE_DELETE_ON_CLOSE, 0, &fnum1))) {
+ status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_NONE,
+ FILE_OVERWRITE_IF,
+ FILE_DELETE_ON_CLOSE, 0, &fnum1);
+ if (NT_STATUS_IS_OK(status)) {
printf("[9] open of %s succeeded should have failed!\n", fname);
- correct = False;
goto fail;
}
printf("ninth delete on close test succeeded.\n");
+ /* Test 10 ... */
+
status = cli_ntcreate(cli1, fname, 0,
FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
0, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[10] open of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[10] close failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
/* This should fail.. */
- if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+ status = cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+ if (NT_STATUS_IS_OK(status)) {
printf("[10] open of %s succeeded should have been deleted on close !\n", fname);
goto fail;
- correct = False;
- } else
- printf("tenth delete on close test succeeded.\n");
+ }
+
+ printf("tenth delete on close test succeeded.\n");
+
+ /* Test 11 ... */
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- /* What error do we get when attempting to open a read-only file with
- delete access ? */
+ /* Can we open a read-only file with delete access? */
/* Create a readonly file. */
status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
FILE_OVERWRITE_IF, 0, 0, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[11] open of %s failed (%s)\n", fname, nt_errstr(status));
- correct = False;
goto fail;
}
status = cli_close(cli1, fnum1);
if (!NT_STATUS_IS_OK(status)) {
printf("[11] close failed (%s)\n", nt_errstr(status));
- correct = False;
goto fail;
}
FILE_READ_ATTRIBUTES|DELETE_ACCESS,
0,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OVERWRITE_IF, 0, 0, &fnum1);
+ FILE_OPEN, 0, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[11] open of %s failed: %s\n", fname, nt_errstr(status));
+ goto fail;
+ }
+
+ cli_close(cli1, fnum1);
+
+ printf("eleventh delete on close test succeeded.\n");
+
+ /*
+ * Test 12
+ * like test 4 but with initial delete on close
+ */
+
+ cli_setatr(cli1, fname, 0, 0);
+ cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+
+ status = cli_ntcreate(cli1, fname, 0,
+ FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_OVERWRITE_IF,
+ FILE_DELETE_ON_CLOSE, 0, &fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[12] open 1 of %s failed (%s)\n", fname, nt_errstr(status));
+ goto fail;
+ }
+
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OPEN, 0, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[12] open 2 of %s failed(%s).\n", fname, nt_errstr(status));
+ goto fail;
+ }
+
+ status = cli_close(cli1, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[12] close 1 failed (%s)\n", nt_errstr(status));
+ goto fail;
+ }
+
+ status = cli_nt_delete_on_close(cli1, fnum1, true);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[12] setting delete_on_close failed (%s)\n", nt_errstr(status));
+ goto fail;
+ }
+
+ /* This should fail - no more opens once delete on close set. */
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OPEN, 0, 0, &fnum2);
if (NT_STATUS_IS_OK(status)) {
- printf("[11] open of %s succeeded should have been denied with ACCESS_DENIED!\n", fname);
- cli_close(cli1, fnum1);
+ printf("[12] open 3 of %s succeeded - should fail).\n", fname);
goto fail;
- correct = False;
- } else {
- if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
- printf("[11] open of %s should have been denied with ACCESS_DENIED! Got error %s\n", fname, nt_errstr(status));
- goto fail;
- correct = False;
- } else {
- printf("eleventh delete on close test succeeded.\n");
- }
}
+ status = cli_nt_delete_on_close(cli1, fnum1, false);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[12] unsetting delete_on_close failed (%s)\n", nt_errstr(status));
+ goto fail;
+ }
+
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OPEN, 0, 0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[12] open 4 of %s failed (%s)\n", fname, nt_errstr(status));
+ goto fail;
+ }
+
+ status = cli_close(cli1, fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[12] close 2 failed (%s)\n", nt_errstr(status));
+ goto fail;
+ }
+
+ status = cli_close(cli1, fnum1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("[12] close 3 failed (%s)\n", nt_errstr(status));
+ goto fail;
+ }
+
+ /*
+ * setting delete on close on the handle does
+ * not unset the initial delete on close...
+ */
+ status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OPEN, 0, 0, &fnum2);
+ if (NT_STATUS_IS_OK(status)) {
+ printf("[12] open 5 of %s succeeded - should fail).\n", fname);
+ goto fail;
+ } else if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+ printf("ntcreate returned %s, expected "
+ "NT_STATUS_OBJECT_NAME_NOT_FOUND\n",
+ nt_errstr(status));
+ goto fail;
+ }
+
+ printf("twelfth delete on close test succeeded.\n");
+
+
printf("finished delete test\n");
+ correct = true;
+
fail:
/* FIXME: This will crash if we aborted before cli2 got
* intialized, because these functions don't handle
cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
cli_unlink(cli, fname_ln, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
/* Create the file. */
status = cli_openx(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum);
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
- d_printf("Capabilities 0x%08x\n", cli_state_capabilities(cli));
+ d_printf("Capabilities 0x%08x\n", smb1cli_conn_capabilities(cli->conn));
if (!torture_close_connection(cli)) {
correct = False;
return False;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
while(1) {
status = cli_ntcreate(cli1, pipe_name, 0, FILE_READ_DATA,
FILE_ATTRIBUTE_NORMAL,
cli_setatr(cli1, fname, 0, 0);
cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
status = cli_openx(cli1, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE, &fnum1);
if (!NT_STATUS_IS_OK(status)) {
cli_setatr(cli2, fname, 0, 0);
cli_unlink(cli2, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
- cli_sockopt(cli2, sockops);
+ smbXcli_conn_set_sockopt(cli2->conn, sockops);
printf("TEST #1 testing 2 non-io opens (no delete)\n");
status = cli_ntcreate(cli1, fname, 0, FILE_READ_ATTRIBUTES,
bool correct = false;
NTSTATUS status;
size_t nread;
+ const char *fname_windows = "windows_file";
+ uint16_t fnum2 = (uint16_t)-1;
printf("Starting simple POSIX open test\n");
return false;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
status = torture_setup_unix_extensions(cli1);
if (!NT_STATUS_IS_OK(status)) {
cli_posix_unlink(cli1, hname);
cli_setatr(cli1, sname, 0, 0);
cli_posix_unlink(cli1, sname);
+ cli_setatr(cli1, fname_windows, 0, 0);
+ cli_posix_unlink(cli1, fname_windows);
/* Create a directory. */
status = cli_posix_mkdir(cli1, dname, 0777);
goto out;
}
+ /* Ensure st_mode == 0600 */
+ if ((sbuf.st_ex_mode & 07777) != 0600) {
+ printf("posix_open - bad permissions 0%o != 0600\n",
+ (unsigned int)(sbuf.st_ex_mode & 07777));
+ goto out;
+ }
+
/* Test ftruncate - set file size back to zero. */
status = cli_ftruncate(cli1, fnum1, 0);
if (!NT_STATUS_IS_OK(status)) {
goto out;
}
+ /* Check directory opens with a specific permission. */
+ status = cli_posix_mkdir(cli1, dname, 0700);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("POSIX mkdir of %s failed (%s)\n", dname, nt_errstr(status));
+ goto out;
+ }
+
+ /* Ensure st_mode == 0700 */
+ status = cli_posix_stat(cli1, dname, &sbuf);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("stat failed (%s)\n", nt_errstr(status));
+ goto out;
+ }
+
+ if ((sbuf.st_ex_mode & 07777) != 0700) {
+ printf("posix_mkdir - bad permissions 0%o != 0700\n",
+ (unsigned int)(sbuf.st_ex_mode & 07777));
+ goto out;
+ }
+
+ /*
+ * Now create a Windows file, and attempt a POSIX unlink.
+ * This should fail with a sharing violation but due to:
+ *
+ * [Bug 9571] Unlink after open causes smbd to panic
+ *
+ * ensure we've fixed the lock ordering violation.
+ */
+
+ status = cli_ntcreate(cli1, fname_windows, 0,
+ FILE_READ_DATA|FILE_WRITE_DATA, 0,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_CREATE,
+ 0x0, 0x0, &fnum2);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Windows create of %s failed (%s)\n", fname_windows,
+ nt_errstr(status));
+ goto out;
+ }
+
+ /* Now try posix_unlink. */
+ status = cli_posix_unlink(cli1, fname_windows);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
+ printf("POSIX unlink of %s should fail "
+ "with NT_STATUS_SHARING_VIOLATION "
+ "got %s instead !\n",
+ fname_windows,
+ nt_errstr(status));
+ goto out;
+ }
+
+ cli_close(cli1, fnum2);
+
printf("Simple POSIX open test passed\n");
correct = true;
fnum1 = (uint16_t)-1;
}
+ if (fnum2 != (uint16_t)-1) {
+ cli_close(cli1, fnum2);
+ fnum2 = (uint16_t)-1;
+ }
+
cli_setatr(cli1, sname, 0, 0);
cli_posix_unlink(cli1, sname);
cli_setatr(cli1, hname, 0, 0);
cli_posix_unlink(cli1, fname);
cli_setatr(cli1, dname, 0, 0);
cli_posix_rmdir(cli1, dname);
+ cli_setatr(cli1, fname_windows, 0, 0);
+ cli_posix_unlink(cli1, fname_windows);
if (!torture_close_connection(cli1)) {
correct = false;
return False;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
for (k = 0, i = 0; i < sizeof(open_attrs_table)/sizeof(uint32); i++) {
cli_setatr(cli1, fname, 0, 0);
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
srandom(0);
for (i=0;i<torture_numops;i++) {
ret = check_error(__LINE__, status, ERRDOS, ERRbadfile,
NT_STATUS_OBJECT_NAME_NOT_FOUND);
} else {
- printf("* chkpath on a non existant file should fail\n");
+ printf("* chkpath on a non existent file should fail\n");
ret = False;
}
correct = False;
}
- /* Try and delete a non existant EA. */
+ /* Try and delete a non existent EA. */
status = cli_set_ea_path(cli, fname, "foo", "", 0);
if (!NT_STATUS_IS_OK(status)) {
- printf("deleting non-existant EA 'foo' should succeed. %s\n",
+ printf("deleting non-existent EA 'foo' should succeed. %s\n",
nt_errstr(status));
correct = False;
}
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
cli_list(cli, "\\LISTDIR\\*", 0, del_fn, cli);
cli_list(cli, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, del_fn, cli);
}
disable_spnego = false;
- status = cli_negprot(c_nt, PROTOCOL_NT1);
+ status = smbXcli_negprot(c_nt->conn, c_nt->timeout, PROTOCOL_CORE,
+ PROTOCOL_NT1);
if (!NT_STATUS_IS_OK(status)) {
printf("%s rejected the NT-error negprot (%s)\n", host,
disable_spnego = false;
force_dos_errors = false;
- status = cli_negprot(c_dos, PROTOCOL_NT1);
+ status = smbXcli_negprot(c_dos->conn, c_dos->timeout, PROTOCOL_CORE,
+ PROTOCOL_NT1);
if (!NT_STATUS_IS_OK(status)) {
printf("%s rejected the DOS-error negprot (%s)\n", host,
nt_errstr(status));
return False;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
reqs[0] = cli_openx_create(talloc_tos(), evt, cli1, "\\test",
O_CREAT|O_RDWR, 0, &smbreqs[0]);
if (reqs[2] == NULL) return false;
tevent_req_set_callback(reqs[2], chain1_close_completion, &done);
- status = cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs));
+ status = smb1cli_req_chain_submit(smbreqs, ARRAY_SIZE(smbreqs));
if (!NT_STATUS_IS_OK(status)) {
return false;
}
return False;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
reqs[0] = cli_session_setup_guest_create(talloc_tos(), evt, cli1,
&smbreqs[0]);
if (reqs[1] == NULL) return false;
tevent_req_set_callback(reqs[1], chain2_tcon_completion, &done);
- status = cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs));
+ status = smb1cli_req_chain_submit(smbreqs, ARRAY_SIZE(smbreqs));
if (!NT_STATUS_IS_OK(status)) {
return false;
}
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
status = cli_ntcreate(cli, fname, 0, GENERIC_ALL_ACCESS|DELETE_ACCESS,
FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
return False;
}
- cli_sockopt(cli1, sockops);
+ smbXcli_conn_set_sockopt(cli1->conn, sockops);
start_time = timeval_current();
if (!torture_open_connection(&cli, 0)) {
return false;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
status = cli_echo(cli, 5, data_blob_const("hello", 5));
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
/* Ok - now save then logoff our current user. */
old_vuid = cli_state_get_uid(cli);
return False;
}
- cli_sockopt(cli, sockops);
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
cli_list(cli, "\\shortname\\*", 0, shortname_del_fn, cli);
cli_list(cli, "\\shortname\\*", FILE_ATTRIBUTE_DIRECTORY, shortname_del_fn, cli);
/*
* upper-case the type field
*/
- strupper_m(strchr_m(stream, ':')+1);
+ (void)strupper_m(strchr_m(stream, ':')+1);
}
done:
break;
}
- status = dbwrap_fetch_uint32(db, "transtest", &val);
+ status = dbwrap_fetch_uint32_bystring(db, "transtest", &val);
if (!NT_STATUS_IS_OK(status)) {
printf(__location__ "dbwrap_fetch_uint32 failed: %s\n",
nt_errstr(status));
}
}
- status = dbwrap_fetch_uint32(db, "transtest", &val2);
+ status = dbwrap_fetch_uint32_bystring(db, "transtest", &val2);
if (!NT_STATUS_IS_OK(status)) {
printf(__location__ "dbwrap_fetch_uint32 failed: %s\n",
nt_errstr(status));
return true;
}
+static const char *remove_duplicate_addrs2_test_strings_vector[] = {
+ "0.0.0.0",
+ "::0",
+ "1.2.3.1",
+ "0.0.0.0",
+ "0.0.0.0",
+ "1.2.3.2",
+ "1.2.3.3",
+ "1.2.3.4",
+ "1.2.3.5",
+ "::0",
+ "1.2.3.6",
+ "1.2.3.7",
+ "::0",
+ "::0",
+ "::0",
+ "1.2.3.8",
+ "1.2.3.9",
+ "1.2.3.10",
+ "1.2.3.11",
+ "1.2.3.12",
+ "1.2.3.13",
+ "1001:1111:1111:1000:0:1111:1111:1111",
+ "1.2.3.1",
+ "1.2.3.2",
+ "1.2.3.3",
+ "1.2.3.12",
+ "::0",
+ "::0"
+};
+
+static const char *remove_duplicate_addrs2_test_strings_result[] = {
+ "1.2.3.1",
+ "1.2.3.2",
+ "1.2.3.3",
+ "1.2.3.4",
+ "1.2.3.5",
+ "1.2.3.6",
+ "1.2.3.7",
+ "1.2.3.8",
+ "1.2.3.9",
+ "1.2.3.10",
+ "1.2.3.11",
+ "1.2.3.12",
+ "1.2.3.13",
+ "1001:1111:1111:1000:0:1111:1111:1111"
+};
+
+static bool run_local_remove_duplicate_addrs2(int dummy)
+{
+ struct ip_service test_vector[28];
+ int count, i;
+
+ /* Construct the sockaddr_storage test vector. */
+ for (i = 0; i < 28; i++) {
+ struct addrinfo hints;
+ struct addrinfo *res = NULL;
+ int ret;
+
+ memset(&hints, '\0', sizeof(hints));
+ hints.ai_flags = AI_NUMERICHOST;
+ ret = getaddrinfo(remove_duplicate_addrs2_test_strings_vector[i],
+ NULL,
+ &hints,
+ &res);
+ if (ret) {
+ fprintf(stderr, "getaddrinfo failed on [%s]\n",
+ remove_duplicate_addrs2_test_strings_vector[i]);
+ return false;
+ }
+ memset(&test_vector[i], '\0', sizeof(test_vector[i]));
+ memcpy(&test_vector[i].ss,
+ res->ai_addr,
+ res->ai_addrlen);
+ freeaddrinfo(res);
+ }
+
+ count = remove_duplicate_addrs2(test_vector, i);
+
+ if (count != 14) {
+ fprintf(stderr, "count wrong (%d) should be 14\n",
+ count);
+ return false;
+ }
+
+ for (i = 0; i < count; i++) {
+ char addr[INET6_ADDRSTRLEN];
+
+ print_sockaddr(addr, sizeof(addr), &test_vector[i].ss);
+
+ if (strcmp(addr, remove_duplicate_addrs2_test_strings_result[i]) != 0) {
+ fprintf(stderr, "mismatch on [%d] [%s] [%s]\n",
+ i,
+ addr,
+ remove_duplicate_addrs2_test_strings_result[i]);
+ return false;
+ }
+ }
+
+ printf("run_local_remove_duplicate_addrs2: success\n");
+ return true;
+}
+
+static bool run_local_tdb_opener(int dummy)
+{
+ TDB_CONTEXT *t;
+ unsigned v = 0;
+
+ while (1) {
+ t = tdb_open("test.tdb", 1000, TDB_CLEAR_IF_FIRST,
+ O_RDWR|O_CREAT, 0755);
+ if (t == NULL) {
+ perror("tdb_open failed");
+ return false;
+ }
+ tdb_close(t);
+
+ v += 1;
+ printf("\r%u", v);
+ }
+ return true;
+}
+
+static bool run_local_tdb_writer(int dummy)
+{
+ TDB_CONTEXT *t;
+ unsigned v = 0;
+ TDB_DATA val;
+
+ t = tdb_open("test.tdb", 1000, 0, O_RDWR|O_CREAT, 0755);
+ if (t == 0) {
+ perror("tdb_open failed");
+ return 1;
+ }
+
+ val.dptr = (uint8_t *)&v;
+ val.dsize = sizeof(v);
+
+ while (1) {
+ TDB_DATA data;
+ int ret;
+
+ ret = tdb_store(t, val, val, 0);
+ if (ret != 0) {
+ printf("%s\n", tdb_errorstr(t));
+ }
+ v += 1;
+ printf("\r%u", v);
+
+ data = tdb_fetch(t, val);
+ if (data.dptr != NULL) {
+ SAFE_FREE(data.dptr);
+ }
+ }
+ return true;
+}
+
static double create_procs(bool (*fn)(int), bool *result)
{
int i, status;
synccount = 0;
- child_status = (volatile pid_t *)shm_setup(sizeof(pid_t)*torture_nprocs);
+ child_status = (volatile pid_t *)anonymous_shared_allocate(sizeof(pid_t)*torture_nprocs);
if (!child_status) {
printf("Failed to setup shared memory\n");
return -1;
}
- child_status_out = (volatile bool *)shm_setup(sizeof(bool)*torture_nprocs);
+ child_status_out = (volatile bool *)anonymous_shared_allocate(sizeof(bool)*torture_nprocs);
if (!child_status_out) {
printf("Failed to setup result status shared memory\n");
return -1;
{ "LOCAL-sprintf_append", run_local_sprintf_append, 0},
{ "LOCAL-hex_encode_buf", run_local_hex_encode_buf, 0},
{ "LOCAL-IDMAP-TDB-COMMON", run_idmap_tdb_common_test, 0},
+ { "LOCAL-remove_duplicate_addrs2", run_local_remove_duplicate_addrs2, 0},
+ { "local-tdb-opener", run_local_tdb_opener, 0 },
+ { "local-tdb-writer", run_local_tdb_writer, 0 },
+ { "LOCAL-DBWRAP-CTDB", run_local_dbwrap_ctdb, 0 },
{NULL, NULL, 0}};
-
+/*
+ * dummy function to satisfy linker dependency
+ */
+struct tevent_context *winbind_event_context(void);
+struct tevent_context *winbind_event_context(void)
+{
+ return NULL;
+}
/****************************************************************************
run a specified test or "ALL"
if(use_kerberos && !gotuser) gotpass = True;
while (!gotpass) {
- p = getpass("Password:");
- if (p) {
- fstrcpy(password, p);
+ char pwd[256] = {0};
+ int rc;
+
+ rc = samba_getpass("Password:", pwd, sizeof(pwd), false, false);
+ if (rc == 0) {
+ fstrcpy(password, pwd);
gotpass = 1;
}
}