diff options
author | Günther Deschner <gd@samba.org> | 2008-10-21 01:20:53 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-10-27 19:33:22 +0100 |
commit | 6a2dabe1a7faae47dce359b77d886a9489b66fcb (patch) | |
tree | 5da6140b3215b205d78fa0e47b7ce38ae1ab4449 /source4 | |
parent | 6131c0d8888c8bc1923794b9b93c1cb44bb071e3 (diff) | |
download | samba-6a2dabe1a7faae47dce359b77d886a9489b66fcb.tar.gz samba-6a2dabe1a7faae47dce359b77d886a9489b66fcb.tar.bz2 samba-6a2dabe1a7faae47dce359b77d886a9489b66fcb.zip |
s4-lsa: merge lsa_GetUserName from s3 lsa idl.
Guenther
Diffstat (limited to 'source4')
-rw-r--r-- | source4/librpc/idl/lsa.idl | 8 | ||||
-rw-r--r-- | source4/rpc_server/lsa/dcesrv_lsa.c | 26 | ||||
-rw-r--r-- | source4/torture/rpc/lsa.c | 23 | ||||
-rw-r--r-- | source4/torture/rpc/object_uuid.c | 8 | ||||
-rw-r--r-- | source4/torture/rpc/samba3rpc.c | 13 | ||||
-rw-r--r-- | source4/torture/rpc/schannel.c | 21 |
6 files changed, 60 insertions, 39 deletions
diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl index c4413d6406..ae69e03cb2 100644 --- a/source4/librpc/idl/lsa.idl +++ b/source4/librpc/idl/lsa.idl @@ -870,14 +870,10 @@ import "misc.idl", "security.idl"; /**********************/ /* Function: 0x2d */ - typedef struct { - lsa_String *string; - } lsa_StringPointer; - NTSTATUS lsa_GetUserName( [in,unique] [string,charset(UTF16)] uint16 *system_name, - [in,out,unique] lsa_String *account_name, - [in,out,unique] lsa_StringPointer *authority_name + [in,out,ref] lsa_String **account_name, + [in,out,unique] lsa_String **authority_name ); /**********************/ diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index b009d2f2f8..52d054886c 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -2875,19 +2875,23 @@ static NTSTATUS dcesrv_lsa_GetUserName(struct dcesrv_call_state *dce_call, TALLO const char *account_name; const char *authority_name; struct lsa_String *_account_name; - struct lsa_StringPointer *_authority_name = NULL; + struct lsa_String *_authority_name = NULL; /* this is what w2k3 does */ r->out.account_name = r->in.account_name; r->out.authority_name = r->in.authority_name; - if (r->in.account_name && r->in.account_name->string) { + if (r->in.account_name + && *r->in.account_name + /* && *(*r->in.account_name)->string */ + ) { return NT_STATUS_INVALID_PARAMETER; } - if (r->in.authority_name && - r->in.authority_name->string && - r->in.authority_name->string->string) { + if (r->in.authority_name + && *r->in.authority_name + /* && *(*r->in.authority_name)->string */ + ) { return NT_STATUS_INVALID_PARAMETER; } @@ -2899,15 +2903,15 @@ static NTSTATUS dcesrv_lsa_GetUserName(struct dcesrv_call_state *dce_call, TALLO _account_name->string = account_name; if (r->in.authority_name) { - _authority_name = talloc(mem_ctx, struct lsa_StringPointer); + _authority_name = talloc(mem_ctx, struct lsa_String); NT_STATUS_HAVE_NO_MEMORY(_authority_name); - _authority_name->string = talloc(mem_ctx, struct lsa_String); - NT_STATUS_HAVE_NO_MEMORY(_authority_name->string); - _authority_name->string->string = authority_name; + _authority_name->string = authority_name; } - r->out.account_name = _account_name; - r->out.authority_name = _authority_name; + *r->out.account_name = _account_name; + if (r->out.authority_name) { + *r->out.authority_name = _authority_name; + } return status; } diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index 8ac337c740..d299176285 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -2446,14 +2446,27 @@ static bool test_GetUserName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) struct lsa_GetUserName r; NTSTATUS status; bool ret = true; - struct lsa_StringPointer authority_name_p; + struct lsa_String *authority_name_p = NULL; + struct lsa_String *account_name_p = NULL; printf("\nTesting GetUserName\n"); - r.in.system_name = "\\"; - r.in.account_name = NULL; - r.in.authority_name = &authority_name_p; - authority_name_p.string = NULL; + r.in.system_name = "\\"; + r.in.account_name = &account_name_p; + r.in.authority_name = NULL; + r.out.account_name = &account_name_p; + + status = dcerpc_lsa_GetUserName(p, mem_ctx, &r); + + if (!NT_STATUS_IS_OK(status)) { + printf("GetUserName failed - %s\n", nt_errstr(status)); + ret = false; + } + + account_name_p = NULL; + r.in.account_name = &account_name_p; + r.in.authority_name = &authority_name_p; + r.out.account_name = &account_name_p; status = dcerpc_lsa_GetUserName(p, mem_ctx, &r); diff --git a/source4/torture/rpc/object_uuid.c b/source4/torture/rpc/object_uuid.c index 5a77bd1c29..69905169af 100644 --- a/source4/torture/rpc/object_uuid.c +++ b/source4/torture/rpc/object_uuid.c @@ -39,7 +39,8 @@ static bool test_random_uuid(struct torture_context *torture) struct GUID uuid; struct dssetup_DsRoleGetPrimaryDomainInformation r1; struct lsa_GetUserName r2; - struct lsa_StringPointer authority_name_p; + struct lsa_String *authority_name_p = NULL; + struct lsa_String *account_name_p = NULL; torture_comment(torture, "RPC-OBJECTUUID-RANDOM\n"); @@ -63,9 +64,10 @@ static bool test_random_uuid(struct torture_context *torture) uuid = GUID_random(); r2.in.system_name = "\\"; - r2.in.account_name = NULL; + r2.in.account_name = &account_name_p; r2.in.authority_name = &authority_name_p; - authority_name_p.string = NULL; + r2.out.account_name = &account_name_p; + r2.out.authority_name = &authority_name_p; req = dcerpc_ndr_request_send(p2, &uuid, &ndr_table_lsarpc, diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 85714ace13..25cbb6727d 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -1583,7 +1583,8 @@ static struct dom_sid *whoami(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *lsa; struct lsa_GetUserName r; NTSTATUS status; - struct lsa_StringPointer authority_name_p; + struct lsa_String *authority_name_p = NULL; + struct lsa_String *account_name_p = NULL; struct dom_sid *result; status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\lsarpc", @@ -1595,12 +1596,14 @@ static struct dom_sid *whoami(TALLOC_CTX *mem_ctx, } r.in.system_name = "\\"; - r.in.account_name = NULL; - authority_name_p.string = NULL; + r.in.account_name = &account_name_p; r.in.authority_name = &authority_name_p; + r.out.account_name = &account_name_p; status = dcerpc_lsa_GetUserName(lsa, mem_ctx, &r); + authority_name_p = *r.out.authority_name; + if (!NT_STATUS_IS_OK(status)) { printf("(%s) GetUserName failed - %s\n", __location__, nt_errstr(status)); @@ -1608,8 +1611,8 @@ static struct dom_sid *whoami(TALLOC_CTX *mem_ctx, return NULL; } - result = name2sid(mem_ctx, lsa, r.out.account_name->string, - r.out.authority_name->string->string); + result = name2sid(mem_ctx, lsa, account_name_p->string, + authority_name_p->string); talloc_free(lsa); return result; diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 15d40a2e17..a8aa046280 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -182,18 +182,21 @@ static bool test_lsa_ops(struct torture_context *tctx, struct dcerpc_pipe *p) struct lsa_GetUserName r; NTSTATUS status; bool ret = true; - struct lsa_StringPointer authority_name_p; + struct lsa_String *account_name_p = NULL; + struct lsa_String *authority_name_p = NULL; printf("\nTesting GetUserName\n"); r.in.system_name = "\\"; - r.in.account_name = NULL; + r.in.account_name = &account_name_p; r.in.authority_name = &authority_name_p; - authority_name_p.string = NULL; + r.out.account_name = &account_name_p; /* do several ops to test credential chaining and various operations */ status = dcerpc_lsa_GetUserName(p, tctx, &r); - + + authority_name_p = *r.out.authority_name; + if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) { printf("not considering %s to be an error\n", nt_errstr(status)); } else if (!NT_STATUS_IS_OK(status)) { @@ -204,18 +207,18 @@ static bool test_lsa_ops(struct torture_context *tctx, struct dcerpc_pipe *p) return false; } - if (strcmp(r.out.account_name->string, "ANONYMOUS LOGON") != 0) { + if (strcmp(account_name_p->string, "ANONYMOUS LOGON") != 0) { printf("GetUserName returned wrong user: %s, expected %s\n", - r.out.account_name->string, "ANONYMOUS LOGON"); + account_name_p->string, "ANONYMOUS LOGON"); return false; } - if (!r.out.authority_name || !r.out.authority_name->string) { + if (!authority_name_p || !authority_name_p->string) { return false; } - if (strcmp(r.out.authority_name->string->string, "NT AUTHORITY") != 0) { + if (strcmp(authority_name_p->string, "NT AUTHORITY") != 0) { printf("GetUserName returned wrong user: %s, expected %s\n", - r.out.authority_name->string->string, "NT AUTHORITY"); + authority_name_p->string, "NT AUTHORITY"); return false; } } |