#include "libcli/libcli.h"
#include "libcli/raw/raw_proto.h"
#include "torture/torture.h"
+#include "torture/unix/proto.h"
#include "lib/cmdline/popt_common.h"
#include "auth/credentials/credentials.h"
#include "param/param.h"
lpcfg_gensec_settings(tctx, tctx->lp_ctx));
if (!NT_STATUS_IS_OK(status)) {
- printf("failed to connect to //%s/%s: %s\n",
- host, share, nt_errstr(status));
+ torture_comment(tctx,
+ "FATAL: Failed to connect to //%s/%s "
+ "with %s - %s\n",
+ host,
+ share,
+ cli_credentials_get_username(creds),
+ nt_errstr(status));
return NULL;
}
for (i = 0; i < el->num_values; i++) {
struct dom_sid *sid = talloc(torture, struct dom_sid);
+ struct sid_parse_ret ret;
torture_assert(torture, sid != NULL, "talloc failed");
-
- torture_assert(torture, sid_blob_parse(el->values[i], sid), "sid parse failed");
+
+ ret = sid_parse(el->values[i].data,
+ el->values[i].length, sid);
+ torture_assert(torture,
+ ret.len != -1,
+ "sid parse failed");
torture_assert_str_equal(torture, dom_sid_string(sid, sid), dom_sid_string(sid, whoami->sid_list[i]), "SID from LDAP and SID from CIFS does not match!");
talloc_free(sid);
}
struct dom_sid *dom_sid = talloc(torture, struct dom_sid);
struct dom_sid *dc_sids = talloc_array(torture, struct dom_sid, el->num_values);
struct dom_sid *member_sids = talloc_array(torture, struct dom_sid, whoami->num_sids);
+ struct sid_parse_ret ret;
torture_assert(torture, user_sid != NULL, "talloc failed");
- torture_assert(torture, sid_blob_parse(el->values[0], user_sid), "sid parse failed");
+ ret = sid_parse(el->values[0].data,
+ el->values[0].length,
+ user_sid);
+ torture_assert(torture,
+ ret.len != -1,
+ "sid parse failed");
torture_assert_ntstatus_equal(torture, dom_sid_split_rid(torture, user_sid, &dom_sid, NULL), NT_STATUS_OK, "failed to split domain SID from user SID");
for (i = 0; i < el->num_values; i++) {
struct dom_sid *sid = talloc(dc_sids, struct dom_sid);
torture_assert(torture, sid != NULL, "talloc failed");
-
- torture_assert(torture, sid_blob_parse(el->values[i], sid), "sid parse failed");
+
+ ret = sid_parse(el->values[i].data,
+ el->values[i].length,
+ sid);
+ torture_assert(torture,
+ ret.len != -1,
+ "sid parse failed");
if (dom_sid_in_domain(dom_sid, sid)) {
dc_sids[num_domain_sids_dc] = *sid;
num_domain_sids_dc++;
{
struct smbcli_state *cli;
struct smb_whoami whoami;
- bool ret;
+ bool ret = false;
struct ldb_context *ldb;
const char *addc, *host;
- cli = connect_to_server(torture, cmdline_credentials);
+ cli = connect_to_server(torture, popt_get_cmdline_credentials());
torture_assert(torture, cli, "connecting to server with authenticated credentials");
/* Test basic authenticated mapping. */
cli, &whoami, 0xFFFF), ret, fail,
"calling SMB_QFS_POSIX_WHOAMI on an authenticated connection");
+ /* Check that our anonymous login mapped us to guest on the server, but
+ * only if the server supports this.
+ */
+ if (whoami.mapping_mask & SMB_WHOAMI_GUEST) {
+ bool guest = whoami.mapping_flags & SMB_WHOAMI_GUEST;
+ torture_comment(torture, "checking whether we were logged in as guest... %s\n",
+ guest ? "YES" : "NO");
+ torture_assert(torture,
+ cli_credentials_is_anonymous(
+ popt_get_cmdline_credentials()) == guest,
+ "login did not credentials map to guest");
+ } else {
+ torture_comment(torture, "server does not support SMB_WHOAMI_GUEST flag\n");
+ }
+
addc = torture_setting_string(torture, "addc", NULL);
host = torture_setting_string(torture, "host", NULL);
if (addc) {
ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, talloc_asprintf(torture, "ldap://%s", addc),
- NULL, cmdline_credentials, 0);
+ NULL, popt_get_cmdline_credentials(), 0);
torture_assert(torture, ldb, "ldb connect failed");
/* We skip this testing if we could not contact the LDAP server */
smbcli_tdis(cli);
- /* Check that our anonymous login mapped us to guest on the server, but
- * only if the server supports this.
- */
- if (whoami.mapping_mask & SMB_WHOAMI_GUEST) {
- bool guest = whoami.mapping_flags & SMB_WHOAMI_GUEST;
- printf("checking whether we were logged in as guest... %s\n",
- guest ? "YES" : "NO");
- torture_assert(torture, cli_credentials_is_anonymous(cmdline_credentials) == guest,
- "login did not credentials map to guest");
- } else {
- printf("server does not support SMB_WHOAMI_GUEST flag\n");
- }
-
return true;
fail: