svn commit: samba r26368 - in branches/4.0-python: . source
source/auth source/client source/dsdb/samdb/ldb_modules
source/lib/socket source/torture/rpc
jelmer at samba.org
jelmer at samba.org
Mon Dec 10 09:36:32 GMT 2007
Author: jelmer
Date: 2007-12-10 09:36:30 +0000 (Mon, 10 Dec 2007)
New Revision: 26368
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26368
Log:
Merge upstream.
Added:
branches/4.0-python/source/lib/socket/connect.h
Modified:
branches/4.0-python/
branches/4.0-python/source/auth/auth_anonymous.c
branches/4.0-python/source/auth/auth_developer.c
branches/4.0-python/source/auth/ntlm_check.c
branches/4.0-python/source/client/client.c
branches/4.0-python/source/dsdb/samdb/ldb_modules/partition.c
branches/4.0-python/source/samba4-skip
branches/4.0-python/source/torture/rpc/lsa.c
Changeset:
Property changes on: branches/4.0-python
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:ancestry:v3-trunk0
...skipped...
Name: bzr:file-ids
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...
Modified: branches/4.0-python/source/auth/auth_anonymous.c
===================================================================
--- branches/4.0-python/source/auth/auth_anonymous.c 2007-12-10 09:35:38 UTC (rev 26367)
+++ branches/4.0-python/source/auth/auth_anonymous.c 2007-12-10 09:36:30 UTC (rev 26368)
@@ -57,7 +57,7 @@
return auth_anonymous_server_info(mem_ctx, lp_netbios_name(ctx->auth_ctx->lp_ctx), _server_info);
}
-static struct auth_operations anonymous_auth_ops = {
+static const struct auth_operations anonymous_auth_ops = {
.name = "anonymous",
.get_challenge = auth_get_challenge_not_implemented,
.want_check = anonymous_want_check,
Modified: branches/4.0-python/source/auth/auth_developer.c
===================================================================
--- branches/4.0-python/source/auth/auth_developer.c 2007-12-10 09:35:38 UTC (rev 26367)
+++ branches/4.0-python/source/auth/auth_developer.c 2007-12-10 09:36:30 UTC (rev 26368)
@@ -130,7 +130,7 @@
return nt_status;
}
-static struct auth_operations name_to_ntstatus_auth_ops = {
+static const struct auth_operations name_to_ntstatus_auth_ops = {
.name = "name_to_ntstatus",
.get_challenge = auth_get_challenge_not_implemented,
.want_check = name_to_ntstatus_want_check,
@@ -180,7 +180,7 @@
return NT_STATUS_NO_SUCH_USER;
}
-static struct auth_operations fixed_challenge_auth_ops = {
+static const struct auth_operations fixed_challenge_auth_ops = {
.name = "fixed_challenge",
.get_challenge = fixed_challenge_get_challenge,
.want_check = fixed_challenge_want_check,
Modified: branches/4.0-python/source/auth/ntlm_check.c
===================================================================
--- branches/4.0-python/source/auth/ntlm_check.c 2007-12-10 09:35:38 UTC (rev 26367)
+++ branches/4.0-python/source/auth/ntlm_check.c 2007-12-10 09:36:30 UTC (rev 26368)
@@ -295,7 +295,7 @@
DATA_BLOB *user_sess_key,
DATA_BLOB *lm_sess_key)
{
- static const uint8_t zeros[8];
+ const static uint8_t zeros[8];
DATA_BLOB tmp_sess_key;
if (stored_nt == NULL) {
Modified: branches/4.0-python/source/client/client.c
===================================================================
--- branches/4.0-python/source/client/client.c 2007-12-10 09:35:38 UTC (rev 26367)
+++ branches/4.0-python/source/client/client.c 2007-12-10 09:36:30 UTC (rev 26368)
@@ -51,8 +51,6 @@
#include "librpc/gen_ndr/ndr_nbt.h"
#include "param/param.h"
-static int io_bufsize = 64512;
-
struct smbclient_context {
char *remote_cur_dir;
struct smbcli_state *cli;
@@ -64,6 +62,7 @@
bool lowercase;
int printmode;
bool translation;
+ int io_bufsize;
};
/* timing globals */
@@ -680,7 +679,7 @@
bool newhandle = false;
uint8_t *data;
struct timeval tp_start;
- int read_size = io_bufsize;
+ int read_size = ctx->io_bufsize;
uint16_t attr;
size_t size;
off_t start = 0;
@@ -1074,7 +1073,7 @@
size_t start = 0;
off_t nread = 0;
uint8_t *buf = NULL;
- int maxwrite = io_bufsize;
+ int maxwrite = ctx->io_bufsize;
int rc = 0;
struct timeval tp_start;
@@ -3017,17 +3016,12 @@
/*****************************************************
return a connection to a server
*******************************************************/
-static struct smbclient_context *do_connect(TALLOC_CTX *mem_ctx,
+static bool do_connect(struct smbclient_context *ctx,
const char *specified_server, const char *specified_share, struct cli_credentials *cred)
{
NTSTATUS status;
- struct smbclient_context *ctx = talloc_zero(mem_ctx, struct smbclient_context);
char *server, *share;
- if (!ctx) {
- return NULL;
- }
-
rl_ctx = ctx; /* Ugly hack */
if (strncmp(specified_share, "\\\\", 2) == 0 ||
@@ -3148,6 +3142,9 @@
exit(1);
}
+ ctx = talloc(mem_ctx, struct smbclient_context);
+ ctx->io_bufsize = 64512;
+
pc = poptGetContext("smbclient", argc, (const char **) argv, long_options, 0);
poptSetOtherOptionHelp(pc, "[OPTIONS] service <password>");
@@ -3176,7 +3173,7 @@
base_directory = strdup(poptGetOptArg(pc));
break;
case 'b':
- io_bufsize = MAX(1, atoi(poptGetOptArg(pc)));
+ ctx->io_bufsize = MAX(1, atoi(poptGetOptArg(pc)));
break;
}
}
@@ -3227,9 +3224,7 @@
return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, dest_ip, name_type, lp_name_resolve_order(cmdline_lp_ctx), lp_max_xmit(cmdline_lp_ctx), lp_maxmux(cmdline_lp_ctx));
}
-
- ctx = do_connect(mem_ctx, desthost, service, cmdline_credentials);
- if (!ctx)
+ if (!do_connect(ctx, desthost, service, cmdline_credentials))
return 1;
if (base_directory)
Modified: branches/4.0-python/source/dsdb/samdb/ldb_modules/partition.c
===================================================================
--- branches/4.0-python/source/dsdb/samdb/ldb_modules/partition.c 2007-12-10 09:35:38 UTC (rev 26367)
+++ branches/4.0-python/source/dsdb/samdb/ldb_modules/partition.c 2007-12-10 09:36:30 UTC (rev 26368)
@@ -711,7 +711,7 @@
{
int ret, i;
TALLOC_CTX *mem_ctx = talloc_new(module);
- static const char *attrs[] = { "partition", "replicateEntries", "modules", NULL };
+ const char *attrs[] = { "partition", "replicateEntries", "modules", NULL };
struct ldb_result *res;
struct ldb_message *msg;
struct ldb_message_element *partition_attributes;
Added: branches/4.0-python/source/lib/socket/connect.h
===================================================================
--- branches/4.0-python/source/lib/socket/connect.h 2007-12-10 09:35:38 UTC (rev 26367)
+++ branches/4.0-python/source/lib/socket/connect.h 2007-12-10 09:36:30 UTC (rev 26368)
@@ -0,0 +1,8 @@
+struct connect_state {
+ struct socket_context *sock;
+ const struct socket_address *my_address;
+ const struct socket_address *server_address;
+ uint32_t flags;
+};
+
+void socket_send_connect(struct composite_context *result);
Modified: branches/4.0-python/source/samba4-skip
===================================================================
--- branches/4.0-python/source/samba4-skip 2007-12-10 09:35:38 UTC (rev 26367)
+++ branches/4.0-python/source/samba4-skip 2007-12-10 09:36:30 UTC (rev 26368)
@@ -49,3 +49,4 @@
^samba4.NET-API-BECOME-DC.*$ # Fails
WINBIND # FIXME: This should not be skipped
NSS-TEST # Fails
+auth.python
Modified: branches/4.0-python/source/torture/rpc/lsa.c
===================================================================
--- branches/4.0-python/source/torture/rpc/lsa.c 2007-12-10 09:35:38 UTC (rev 26367)
+++ branches/4.0-python/source/torture/rpc/lsa.c 2007-12-10 09:36:30 UTC (rev 26368)
@@ -29,6 +29,8 @@
#include "torture/rpc/rpc.h"
#include "param/param.h"
+#define TEST_MACHINENAME "lsatestmach"
+
static void init_lsa_String(struct lsa_String *name, const char *s)
{
name->string = s;
@@ -125,9 +127,27 @@
return true;
}
+
+static const char *sid_type_lookup(enum lsa_SidType r)
+{
+ switch (r) {
+ case SID_NAME_USE_NONE: return "SID_NAME_USE_NONE"; break;
+ case SID_NAME_USER: return "SID_NAME_USER"; break;
+ case SID_NAME_DOM_GRP: return "SID_NAME_DOM_GRP"; break;
+ case SID_NAME_DOMAIN: return "SID_NAME_DOMAIN"; break;
+ case SID_NAME_ALIAS: return "SID_NAME_ALIAS"; break;
+ case SID_NAME_WKN_GRP: return "SID_NAME_WKN_GRP"; break;
+ case SID_NAME_DELETED: return "SID_NAME_DELETED"; break;
+ case SID_NAME_INVALID: return "SID_NAME_INVALID"; break;
+ case SID_NAME_UNKNOWN: return "SID_NAME_UNKNOWN"; break;
+ case SID_NAME_COMPUTER: return "SID_NAME_COMPUTER"; break;
+ }
+ return "Invalid sid type\n";
+}
+
static bool test_LookupNames(struct dcerpc_pipe *p,
- TALLOC_CTX *mem_ctx,
- struct policy_handle *handle,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
struct lsa_TransNameArray *tnames)
{
struct lsa_LookupNames r;
@@ -157,11 +177,34 @@
r.out.sids = &sids;
status = dcerpc_lsa_LookupNames(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status)) {
+
+ if (NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED) ||
+ NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
+ for (i=0;i< tnames->count;i++) {
+ if (i < count && sids.sids[i].sid_type == SID_NAME_UNKNOWN) {
+ printf("LookupName of %s was unmapped\n",
+ tnames->names[i].name.string);
+ } else if (i >=count) {
+ printf("LookupName of %s failed to return a result\n",
+ tnames->names[i].name.string);
+ }
+ }
printf("LookupNames failed - %s\n", nt_errstr(status));
return false;
+ } else if (!NT_STATUS_IS_OK(status)) {
+ printf("LookupNames failed - %s\n", nt_errstr(status));
+ return false;
}
-
+
+ for (i=0;i< tnames->count;i++) {
+ if (i < count && sids.sids[i].sid_type != tnames->names[i].sid_type) {
+ printf("LookupName of %s got unexpected name type: %s\n",
+ tnames->names[i].name.string, sid_type_lookup(sids.sids[i].sid_type));
+ } else if (i >=count) {
+ printf("LookupName of %s failed to return a result\n",
+ tnames->names[i].name.string);
+ }
+ }
printf("\n");
return true;
@@ -228,30 +271,39 @@
tnames.names = &name;
tnames.count = 1;
name.name.string = "NT AUTHORITY\\SYSTEM";
+ name.sid_type = SID_NAME_WKN_GRP;
ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
name.name.string = "NT AUTHORITY\\ANONYMOUS LOGON";
+ name.sid_type = SID_NAME_WKN_GRP;
ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
name.name.string = "NT AUTHORITY\\Authenticated Users";
+ name.sid_type = SID_NAME_WKN_GRP;
ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+#if 0
name.name.string = "NT AUTHORITY";
ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
name.name.string = "NT AUTHORITY\\";
ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+#endif
name.name.string = "BUILTIN\\";
+ name.sid_type = SID_NAME_DOMAIN;
ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
name.name.string = "BUILTIN\\Administrators";
ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
+ name.sid_type = SID_NAME_ALIAS;
name.name.string = "SYSTEM";
+ name.sid_type = SID_NAME_WKN_GRP;
ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
name.name.string = "Everyone";
+ name.sid_type = SID_NAME_WKN_GRP;
ret &= test_LookupNames(p, mem_ctx, handle, &tnames);
return ret;
}
@@ -1954,11 +2006,6 @@
bool ret = true;
printf("\nTesting QueryInfoPolicy\n");
- if (torture_setting_bool(tctx, "samba4", false)) {
- printf("skipping QueryInfoPolicy against Samba4\n");
- return true;
- }
-
for (i=1;i<13;i++) {
r.in.handle = handle;
r.in.level = i;
@@ -2002,19 +2049,38 @@
/* Let's look up some of these names */
struct lsa_TransNameArray tnames;
- tnames.count = 10;
- tnames.names = talloc_array(tctx, struct lsa_TranslatedName, tnames.count);
+ tnames.count = 14;
+ tnames.names = talloc_zero_array(tctx, struct lsa_TranslatedName, tnames.count);
tnames.names[0].name.string = r.out.info->dns.name.string;
+ tnames.names[0].sid_type = SID_NAME_DOMAIN;
tnames.names[1].name.string = r.out.info->dns.dns_domain.string;
+ tnames.names[1].sid_type = SID_NAME_DOMAIN;
tnames.names[2].name.string = talloc_asprintf(tctx, "%s\\", r.out.info->dns.name.string);
+ tnames.names[2].sid_type = SID_NAME_DOMAIN;
tnames.names[3].name.string = talloc_asprintf(tctx, "%s\\", r.out.info->dns.dns_domain.string);
+ tnames.names[3].sid_type = SID_NAME_DOMAIN;
tnames.names[4].name.string = talloc_asprintf(tctx, "%s\\guest", r.out.info->dns.name.string);
+ tnames.names[4].sid_type = SID_NAME_USER;
tnames.names[5].name.string = talloc_asprintf(tctx, "%s\\krbtgt", r.out.info->dns.name.string);
+ tnames.names[5].sid_type = SID_NAME_USER;
tnames.names[6].name.string = talloc_asprintf(tctx, "%s\\guest", r.out.info->dns.dns_domain.string);
+ tnames.names[6].sid_type = SID_NAME_USER;
tnames.names[7].name.string = talloc_asprintf(tctx, "%s\\krbtgt", r.out.info->dns.dns_domain.string);
+ tnames.names[7].sid_type = SID_NAME_USER;
tnames.names[8].name.string = talloc_asprintf(tctx, "krbtgt@%s", r.out.info->dns.name.string);
+ tnames.names[8].sid_type = SID_NAME_USER;
tnames.names[9].name.string = talloc_asprintf(tctx, "krbtgt@%s", r.out.info->dns.dns_domain.string);
+ tnames.names[9].sid_type = SID_NAME_USER;
+ tnames.names[10].name.string = talloc_asprintf(tctx, "%s\\"TEST_MACHINENAME "$", r.out.info->dns.name.string);
+ tnames.names[10].sid_type = SID_NAME_USER;
+ tnames.names[11].name.string = talloc_asprintf(tctx, "%s\\"TEST_MACHINENAME "$", r.out.info->dns.dns_domain.string);
+ tnames.names[11].sid_type = SID_NAME_USER;
+ tnames.names[12].name.string = talloc_asprintf(tctx, TEST_MACHINENAME "$@%s", r.out.info->dns.name.string);
+ tnames.names[12].sid_type = SID_NAME_USER;
+ tnames.names[13].name.string = talloc_asprintf(tctx, TEST_MACHINENAME "$@%s", r.out.info->dns.dns_domain.string);
+ tnames.names[13].sid_type = SID_NAME_USER;
ret &= test_LookupNames(p, tctx, handle, &tnames);
+
}
}
@@ -2134,6 +2200,8 @@
struct dcerpc_pipe *p;
bool ret = true;
struct policy_handle *handle;
+ struct test_join *join = NULL;
+ struct cli_credentials *machine_creds;
status = torture_rpc_connection(tctx, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
@@ -2149,6 +2217,11 @@
}
if (handle) {
+ join = torture_join_domain(tctx, TEST_MACHINENAME, ACB_WSTRUST, &machine_creds);
+ if (!join) {
+ ret = false;
+ }
+
if (!test_LookupNames_wellknown(p, tctx, handle)) {
ret = false;
}
@@ -2206,6 +2279,9 @@
if (!test_lsa_Close(p, tctx, handle)) {
ret = false;
}
+
+ torture_leave_domain(join);
+
} else {
if (!test_many_LookupSids(p, tctx, handle)) {
ret = false;
More information about the samba-cvs
mailing list