summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-11 20:29:31 +0100
committerGünther Deschner <gd@samba.org>2008-02-11 20:49:43 +0100
commite917a8a94a985154e86b792924246cdfcc527e0a (patch)
treedbb99db397d5ecae70788d56ce6252b3851a6626 /source3/rpc_server
parent1a27d29686e6a4e05f138488d3456ae4b86c4642 (diff)
downloadsamba-e917a8a94a985154e86b792924246cdfcc527e0a.tar.gz
samba-e917a8a94a985154e86b792924246cdfcc527e0a.tar.bz2
samba-e917a8a94a985154e86b792924246cdfcc527e0a.zip
Use pidl for _lsa_GetUserName().
Guenther (This used to be commit b24cf05dcad5696a7b948c93de9e995c2b53e80f)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_lsa.c24
-rw-r--r--source3/rpc_server/srv_lsa_nt.c48
2 files changed, 29 insertions, 43 deletions
diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c
index 9f3dd9031c..9865a70e72 100644
--- a/source3/rpc_server/srv_lsa.c
+++ b/source3/rpc_server/srv_lsa.c
@@ -234,29 +234,7 @@ static bool api_lsa_enum_accounts(pipes_struct *p)
static bool api_lsa_unk_get_connuser(pipes_struct *p)
{
- LSA_Q_UNK_GET_CONNUSER q_u;
- LSA_R_UNK_GET_CONNUSER r_u;
-
- prs_struct *data = &p->in_data.data;
- prs_struct *rdata = &p->out_data.rdata;
-
- ZERO_STRUCT(q_u);
- ZERO_STRUCT(r_u);
-
- if(!lsa_io_q_unk_get_connuser("", &q_u, data, 0)) {
- DEBUG(0,("api_lsa_unk_get_connuser: failed to unmarshall LSA_Q_UNK_GET_CONNUSER.\n"));
- return False;
- }
-
- r_u.status = _lsa_unk_get_connuser(p, &q_u, &r_u);
-
- /* store the response in the SMB stream */
- if(!lsa_io_r_unk_get_connuser("", &r_u, rdata, 0)) {
- DEBUG(0,("api_lsa_unk_get_connuser: Failed to marshall LSA_R_UNK_GET_CONNUSER.\n"));
- return False;
- }
-
- return True;
+ return proxy_lsa_call(p, NDR_LSA_GETUSERNAME);
}
/***************************************************************************
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index bb87422bf9..769dd8ad57 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -55,6 +55,10 @@ static void init_lsa_StringLarge(struct lsa_StringLarge *name, const char *s)
name->string = s;
}
+static void init_lsa_String(struct lsa_String *name, const char *s)
+{
+ name->string = s;
+}
/*******************************************************************
Function to free the per handle data.
@@ -1570,12 +1574,18 @@ NTSTATUS _lsa_enum_accounts(pipes_struct *p, LSA_Q_ENUM_ACCOUNTS *q_u, LSA_R_ENU
return NT_STATUS_OK;
}
+/***************************************************************************
+ _lsa_GetUserName
+ ***************************************************************************/
-NTSTATUS _lsa_unk_get_connuser(pipes_struct *p, LSA_Q_UNK_GET_CONNUSER *q_u, LSA_R_UNK_GET_CONNUSER *r_u)
+NTSTATUS _lsa_GetUserName(pipes_struct *p,
+ struct lsa_GetUserName *r)
{
const char *username, *domname;
user_struct *vuser = get_valid_user_struct(p->vuid);
-
+ struct lsa_String *account_name = NULL;
+ struct lsa_String *authority_name = NULL;
+
if (vuser == NULL)
return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
@@ -1593,20 +1603,24 @@ NTSTATUS _lsa_unk_get_connuser(pipes_struct *p, LSA_Q_UNK_GET_CONNUSER *q_u, LSA
username = vuser->user.smb_name;
domname = vuser->user.domain;
}
-
- r_u->ptr_user_name = 1;
- init_unistr2(&r_u->uni2_user_name, username, UNI_STR_TERMINATE);
- init_uni_hdr(&r_u->hdr_user_name, &r_u->uni2_user_name);
- r_u->unk1 = 1;
-
- r_u->ptr_dom_name = 1;
- init_unistr2(&r_u->uni2_dom_name, domname, UNI_STR_TERMINATE);
- init_uni_hdr(&r_u->hdr_dom_name, &r_u->uni2_dom_name);
+ account_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
+ if (!account_name) {
+ return NT_STATUS_NO_MEMORY;
+ }
- r_u->status = NT_STATUS_OK;
-
- return r_u->status;
+ authority_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
+ if (!authority_name) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ init_lsa_String(account_name, username);
+ init_lsa_String(authority_name, domname);
+
+ *r->out.account_name = account_name;
+ *r->out.authority_name = authority_name;
+
+ return NT_STATUS_OK;
}
/***************************************************************************
@@ -2354,12 +2368,6 @@ NTSTATUS _lsa_RetrievePrivateData(pipes_struct *p, struct lsa_RetrievePrivateDat
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS _lsa_GetUserName(pipes_struct *p, struct lsa_GetUserName *r)
-{
- p->rng_fault_state = True;
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS _lsa_QueryInfoPolicy2(pipes_struct *p, struct lsa_QueryInfoPolicy2 *r)
{
p->rng_fault_state = True;