2005-06-19 02:10:32 +04:00
/*
Unix SMB / CIFS implementation .
Copyright ( C ) Rafal Szczesniak 2005
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2005-06-19 02:10:32 +04:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2005-06-19 02:10:32 +04:00
*/
/*
a composite function for name resolving
*/
# include "includes.h"
2005-06-19 02:29:41 +04:00
# include "libnet/libnet.h"
2005-06-19 02:10:32 +04:00
# include "libcli/composite/composite.h"
2006-08-28 00:37:23 +04:00
# include "auth/credentials/credentials.h"
2006-03-07 14:07:23 +03:00
# include "libcli/resolve/resolve.h"
2010-09-14 11:48:52 +04:00
# include "libcli/finddc.h"
2006-08-28 00:37:23 +04:00
# include "libcli/security/security.h"
# include "librpc/gen_ndr/ndr_lsa_c.h"
2007-10-01 22:52:55 +04:00
# include "param/param.h"
2005-06-19 02:10:32 +04:00
struct lookup_state {
struct nbt_name hostname ;
2006-07-09 16:54:56 +04:00
const char * address ;
2005-06-19 02:10:32 +04:00
} ;
2006-07-09 16:54:56 +04:00
static void continue_name_resolved ( struct composite_context * ctx ) ;
2005-06-22 00:22:38 +04:00
/**
* Sends asynchronous Lookup request
*
* @ param io arguments and result of the call
*/
2005-07-02 18:32:49 +04:00
struct composite_context * libnet_Lookup_send ( struct libnet_context * ctx ,
struct libnet_Lookup * io )
2005-06-19 02:10:32 +04:00
{
struct composite_context * c ;
struct lookup_state * s ;
2006-07-09 16:54:56 +04:00
struct composite_context * cresolve_req ;
2007-12-10 20:41:19 +03:00
struct resolve_context * resolve_ctx ;
2005-06-19 02:10:32 +04:00
/* allocate context and state structures */
2007-05-09 02:08:26 +04:00
c = composite_create ( ctx , ctx - > event_ctx ) ;
2006-07-09 16:54:56 +04:00
if ( c = = NULL ) return NULL ;
2005-06-19 02:10:32 +04:00
s = talloc_zero ( c , struct lookup_state ) ;
2007-05-09 02:08:26 +04:00
if ( composite_nomem ( s , c ) ) return c ;
c - > private_data = s ;
2006-07-09 16:54:56 +04:00
if ( io = = NULL | | io - > in . hostname = = NULL ) {
composite_error ( c , NT_STATUS_INVALID_PARAMETER ) ;
return c ;
}
2005-06-19 02:10:32 +04:00
/* parameters */
s - > hostname . name = talloc_strdup ( s , io - > in . hostname ) ;
2007-05-12 01:51:53 +04:00
if ( composite_nomem ( s - > hostname . name , c ) ) return c ;
2005-06-19 02:10:32 +04:00
s - > hostname . type = io - > in . type ;
s - > hostname . scope = NULL ;
2005-07-02 18:32:49 +04:00
/* name resolution methods */
2007-12-10 20:41:19 +03:00
if ( io - > in . resolve_ctx ) {
resolve_ctx = io - > in . resolve_ctx ;
2005-07-02 18:32:49 +04:00
} else {
2007-12-10 20:41:19 +03:00
resolve_ctx = ctx - > resolve_ctx ;
2005-07-02 18:32:49 +04:00
}
2005-06-19 02:10:32 +04:00
/* send resolve request */
2009-09-19 19:23:03 +04:00
cresolve_req = resolve_name_send ( resolve_ctx , s , & s - > hostname , c - > event_ctx ) ;
2007-05-09 02:08:26 +04:00
if ( composite_nomem ( cresolve_req , c ) ) return c ;
2006-07-09 16:54:56 +04:00
composite_continue ( c , cresolve_req , continue_name_resolved , c ) ;
2005-06-19 02:10:32 +04:00
return c ;
2006-07-09 16:54:56 +04:00
}
2005-06-19 02:10:32 +04:00
2006-07-09 16:54:56 +04:00
static void continue_name_resolved ( struct composite_context * ctx )
{
struct composite_context * c ;
struct lookup_state * s ;
c = talloc_get_type ( ctx - > async . private_data , struct composite_context ) ;
s = talloc_get_type ( c - > private_data , struct lookup_state ) ;
c - > status = resolve_name_recv ( ctx , s , & s - > address ) ;
composite_done ( c ) ;
2005-06-19 02:10:32 +04:00
}
2005-06-22 00:22:38 +04:00
/**
* Waits for and receives results of asynchronous Lookup call
*
* @ param c composite context returned by asynchronous Lookup call
* @ param mem_ctx memory context of the call
* @ param io pointer to results ( and arguments ) of the call
* @ return nt status code of execution
*/
2005-06-19 02:10:32 +04:00
NTSTATUS libnet_Lookup_recv ( struct composite_context * c , TALLOC_CTX * mem_ctx ,
2005-06-19 02:29:41 +04:00
struct libnet_Lookup * io )
2005-06-19 02:10:32 +04:00
{
NTSTATUS status ;
struct lookup_state * s ;
2006-07-09 16:54:56 +04:00
status = composite_wait ( c ) ;
2005-11-16 22:55:27 +03:00
if ( NT_STATUS_IS_OK ( status ) ) {
2006-07-09 16:54:56 +04:00
s = talloc_get_type ( c - > private_data , struct lookup_state ) ;
2009-05-13 16:20:10 +04:00
io - > out . address = ( const char * * ) str_list_make_single ( mem_ctx , s - > address ) ;
2005-11-19 02:27:58 +03:00
NT_STATUS_HAVE_NO_MEMORY ( io - > out . address ) ;
2005-11-16 22:55:27 +03:00
}
2006-07-09 16:54:56 +04:00
talloc_free ( c ) ;
2005-06-19 02:10:32 +04:00
return status ;
}
2005-06-22 00:22:38 +04:00
/**
* Synchronous version of Lookup call
*
* @ param mem_ctx memory context for the call
* @ param io arguments and results of the call
* @ return nt status code of execution
*/
2005-07-02 18:32:49 +04:00
NTSTATUS libnet_Lookup ( struct libnet_context * ctx , TALLOC_CTX * mem_ctx ,
struct libnet_Lookup * io )
2005-06-19 02:10:32 +04:00
{
2005-07-02 18:32:49 +04:00
struct composite_context * c = libnet_Lookup_send ( ctx , io ) ;
2005-06-19 02:10:32 +04:00
return libnet_Lookup_recv ( c , mem_ctx , io ) ;
}
2005-06-22 00:22:38 +04:00
/*
* Shortcut functions to find common types of name
* ( and skip nbt name type argument )
*/
/**
* Sends asynchronous LookupHost request
*/
2005-07-02 18:32:49 +04:00
struct composite_context * libnet_LookupHost_send ( struct libnet_context * ctx ,
struct libnet_Lookup * io )
2005-06-22 00:22:38 +04:00
{
io - > in . type = NBT_NAME_SERVER ;
2005-07-02 18:32:49 +04:00
return libnet_Lookup_send ( ctx , io ) ;
2005-06-22 00:22:38 +04:00
}
/**
* Synchronous version of LookupHost call
*/
2005-07-02 18:32:49 +04:00
NTSTATUS libnet_LookupHost ( struct libnet_context * ctx , TALLOC_CTX * mem_ctx ,
struct libnet_Lookup * io )
2005-06-22 00:22:38 +04:00
{
2005-07-02 18:32:49 +04:00
struct composite_context * c = libnet_LookupHost_send ( ctx , io ) ;
2005-06-22 00:22:38 +04:00
return libnet_Lookup_recv ( c , mem_ctx , io ) ;
}
/**
2006-06-30 00:26:11 +04:00
* Sends asynchronous LookupDCs request
2005-06-22 00:22:38 +04:00
*/
2010-09-13 10:37:10 +04:00
struct tevent_req * libnet_LookupDCs_send ( struct libnet_context * ctx ,
TALLOC_CTX * mem_ctx ,
struct libnet_LookupDCs * io )
2005-06-22 00:22:38 +04:00
{
2010-09-13 10:37:10 +04:00
struct tevent_req * req ;
2010-09-14 11:34:55 +04:00
struct finddcs finddcs_io ;
ZERO_STRUCT ( finddcs_io ) ;
2010-11-27 04:59:51 +03:00
if ( strcasecmp_m ( io - > in . domain_name , lpcfg_workgroup ( ctx - > lp_ctx ) ) = = 0 ) {
finddcs_io . in . domain_name = lpcfg_dnsdomain ( ctx - > lp_ctx ) ;
} else {
finddcs_io . in . domain_name = io - > in . domain_name ;
}
2010-09-14 11:34:55 +04:00
finddcs_io . in . minimum_dc_flags = NBT_SERVER_LDAP | NBT_SERVER_DS | NBT_SERVER_WRITABLE ;
2010-09-24 06:50:00 +04:00
finddcs_io . in . server_address = ctx - > server_address ;
2010-09-14 11:34:55 +04:00
req = finddcs_cldap_send ( mem_ctx , & finddcs_io , ctx - > resolve_ctx , ctx - > event_ctx ) ;
2010-09-13 10:37:10 +04:00
return req ;
2005-06-22 00:22:38 +04:00
}
r12858: This moves the libnet_LookupPdc code to use a GetDC request to find
the remote server's name, or in the absence of a local nbt_server to
communicate with (or without root access), a node status request.
The result is that we are in a better position to use kerberos, as well
as to remove the 'password server' mandatory parameter for the samsync
and samdump commands. (I need this to put these into SWAT).
The only problem I have is that I must create a messaging context, which
requires a server ID. As a client process, I don't expect to get
messages, but it is currently required for replies, so I generate a
random() number. We probably need the servers to accept connections on
streamed sockets too, for client-only tasks that want IRPC.
Because I wanted to test this code, I have put the NET-API-* tests into
our test scripts, to ensure they pass and keep passing. They are good
frontends onto the libnet system, and I see no reason not to test them.
In doing so the NET-API-RPCCONNECT test was simplified to take a
binding string on the command line, removing duplicate code, and
testing the combinations in the scripts instead.
(I have done a bit of work on the list shares code in libnet_share.c
to make it pass 'make test')
In the future, I would like to extend the libcli/findds.c code (based
off volker's winbind/wb_async_helpers.c, which is why it shows up a bit
odd in the patch) to handle getting multiple name replies, sending a
getdc request to each in turn.
(posted to samba-technical for review, and I'll happily update with
any comments)
Andrew Bartlett
(This used to be commit 7ccddfd3515fc2c0d6f447c768ccbf7a220c3380)
2006-01-12 06:02:00 +03:00
/**
* Waits for and receives results of asynchronous Lookup call
*
* @ param c composite context returned by asynchronous Lookup call
* @ param mem_ctx memory context of the call
* @ param io pointer to results ( and arguments ) of the call
* @ return nt status code of execution
*/
2010-09-13 10:37:10 +04:00
NTSTATUS libnet_LookupDCs_recv ( struct tevent_req * req , TALLOC_CTX * mem_ctx ,
r12858: This moves the libnet_LookupPdc code to use a GetDC request to find
the remote server's name, or in the absence of a local nbt_server to
communicate with (or without root access), a node status request.
The result is that we are in a better position to use kerberos, as well
as to remove the 'password server' mandatory parameter for the samsync
and samdump commands. (I need this to put these into SWAT).
The only problem I have is that I must create a messaging context, which
requires a server ID. As a client process, I don't expect to get
messages, but it is currently required for replies, so I generate a
random() number. We probably need the servers to accept connections on
streamed sockets too, for client-only tasks that want IRPC.
Because I wanted to test this code, I have put the NET-API-* tests into
our test scripts, to ensure they pass and keep passing. They are good
frontends onto the libnet system, and I see no reason not to test them.
In doing so the NET-API-RPCCONNECT test was simplified to take a
binding string on the command line, removing duplicate code, and
testing the combinations in the scripts instead.
(I have done a bit of work on the list shares code in libnet_share.c
to make it pass 'make test')
In the future, I would like to extend the libcli/findds.c code (based
off volker's winbind/wb_async_helpers.c, which is why it shows up a bit
odd in the patch) to handle getting multiple name replies, sending a
getdc request to each in turn.
(posted to samba-technical for review, and I'll happily update with
any comments)
Andrew Bartlett
(This used to be commit 7ccddfd3515fc2c0d6f447c768ccbf7a220c3380)
2006-01-12 06:02:00 +03:00
struct libnet_LookupDCs * io )
{
NTSTATUS status ;
2010-09-14 11:34:55 +04:00
struct finddcs finddcs_io ;
status = finddcs_cldap_recv ( req , mem_ctx , & finddcs_io ) ;
talloc_free ( req ) ;
io - > out . num_dcs = 1 ;
io - > out . dcs = talloc ( mem_ctx , struct nbt_dc_name ) ;
NT_STATUS_HAVE_NO_MEMORY ( io - > out . dcs ) ;
io - > out . dcs [ 0 ] . address = finddcs_io . out . address ;
io - > out . dcs [ 0 ] . name = finddcs_io . out . netlogon . data . nt5_ex . pdc_dns_name ;
r12858: This moves the libnet_LookupPdc code to use a GetDC request to find
the remote server's name, or in the absence of a local nbt_server to
communicate with (or without root access), a node status request.
The result is that we are in a better position to use kerberos, as well
as to remove the 'password server' mandatory parameter for the samsync
and samdump commands. (I need this to put these into SWAT).
The only problem I have is that I must create a messaging context, which
requires a server ID. As a client process, I don't expect to get
messages, but it is currently required for replies, so I generate a
random() number. We probably need the servers to accept connections on
streamed sockets too, for client-only tasks that want IRPC.
Because I wanted to test this code, I have put the NET-API-* tests into
our test scripts, to ensure they pass and keep passing. They are good
frontends onto the libnet system, and I see no reason not to test them.
In doing so the NET-API-RPCCONNECT test was simplified to take a
binding string on the command line, removing duplicate code, and
testing the combinations in the scripts instead.
(I have done a bit of work on the list shares code in libnet_share.c
to make it pass 'make test')
In the future, I would like to extend the libcli/findds.c code (based
off volker's winbind/wb_async_helpers.c, which is why it shows up a bit
odd in the patch) to handle getting multiple name replies, sending a
getdc request to each in turn.
(posted to samba-technical for review, and I'll happily update with
any comments)
Andrew Bartlett
(This used to be commit 7ccddfd3515fc2c0d6f447c768ccbf7a220c3380)
2006-01-12 06:02:00 +03:00
return status ;
}
2005-06-22 00:22:38 +04:00
2006-08-28 00:37:23 +04:00
2005-06-22 00:22:38 +04:00
/**
2006-07-09 16:54:56 +04:00
* Synchronous version of LookupDCs
2005-06-22 00:22:38 +04:00
*/
r12858: This moves the libnet_LookupPdc code to use a GetDC request to find
the remote server's name, or in the absence of a local nbt_server to
communicate with (or without root access), a node status request.
The result is that we are in a better position to use kerberos, as well
as to remove the 'password server' mandatory parameter for the samsync
and samdump commands. (I need this to put these into SWAT).
The only problem I have is that I must create a messaging context, which
requires a server ID. As a client process, I don't expect to get
messages, but it is currently required for replies, so I generate a
random() number. We probably need the servers to accept connections on
streamed sockets too, for client-only tasks that want IRPC.
Because I wanted to test this code, I have put the NET-API-* tests into
our test scripts, to ensure they pass and keep passing. They are good
frontends onto the libnet system, and I see no reason not to test them.
In doing so the NET-API-RPCCONNECT test was simplified to take a
binding string on the command line, removing duplicate code, and
testing the combinations in the scripts instead.
(I have done a bit of work on the list shares code in libnet_share.c
to make it pass 'make test')
In the future, I would like to extend the libcli/findds.c code (based
off volker's winbind/wb_async_helpers.c, which is why it shows up a bit
odd in the patch) to handle getting multiple name replies, sending a
getdc request to each in turn.
(posted to samba-technical for review, and I'll happily update with
any comments)
Andrew Bartlett
(This used to be commit 7ccddfd3515fc2c0d6f447c768ccbf7a220c3380)
2006-01-12 06:02:00 +03:00
NTSTATUS libnet_LookupDCs ( struct libnet_context * ctx , TALLOC_CTX * mem_ctx ,
struct libnet_LookupDCs * io )
2005-06-22 00:22:38 +04:00
{
2010-09-13 10:37:10 +04:00
struct tevent_req * req = libnet_LookupDCs_send ( ctx , mem_ctx , io ) ;
return libnet_LookupDCs_recv ( req , mem_ctx , io ) ;
2005-06-22 00:22:38 +04:00
}
2006-08-28 00:37:23 +04:00
struct lookup_name_state {
struct libnet_context * ctx ;
const char * name ;
uint32_t count ;
struct libnet_DomainOpen domopen ;
struct lsa_LookupNames lookup ;
struct lsa_TransSidArray sids ;
struct lsa_String * names ;
/* information about the progress */
void ( * monitor_fn ) ( struct monitor_msg * ) ;
} ;
static bool prepare_lookup_params ( struct libnet_context * ctx ,
struct composite_context * c ,
struct lookup_name_state * s ) ;
static void continue_lookup_name ( struct composite_context * ctx ) ;
2010-03-09 18:59:33 +03:00
static void continue_name_found ( struct tevent_req * subreq ) ;
2006-08-28 00:37:23 +04:00
struct composite_context * libnet_LookupName_send ( struct libnet_context * ctx ,
TALLOC_CTX * mem_ctx ,
struct libnet_LookupName * io ,
void ( * monitor ) ( struct monitor_msg * ) )
{
struct composite_context * c ;
struct lookup_name_state * s ;
2010-03-09 18:59:33 +03:00
struct tevent_req * subreq ;
2007-10-07 02:28:14 +04:00
bool prereq_met = false ;
2006-08-28 00:37:23 +04:00
c = composite_create ( mem_ctx , ctx - > event_ctx ) ;
if ( c = = NULL ) return NULL ;
s = talloc_zero ( c , struct lookup_name_state ) ;
if ( composite_nomem ( s , c ) ) return c ;
c - > private_data = s ;
s - > name = talloc_strdup ( c , io - > in . name ) ;
s - > monitor_fn = monitor ;
s - > ctx = ctx ;
2006-12-23 01:34:45 +03:00
prereq_met = lsa_domain_opened ( ctx , io - > in . domain_name , & c , & s - > domopen ,
2006-08-28 00:37:23 +04:00
continue_lookup_name , monitor ) ;
2006-12-23 01:34:45 +03:00
if ( ! prereq_met ) return c ;
2006-08-28 00:37:23 +04:00
if ( ! prepare_lookup_params ( ctx , c , s ) ) return c ;
2010-03-09 18:59:33 +03:00
subreq = dcerpc_lsa_LookupNames_r_send ( s , c - > event_ctx ,
ctx - > lsa . pipe - > binding_handle ,
& s - > lookup ) ;
if ( composite_nomem ( subreq , c ) ) return c ;
2006-08-28 00:37:23 +04:00
2010-03-09 18:59:33 +03:00
tevent_req_set_callback ( subreq , continue_name_found , c ) ;
2006-08-28 00:37:23 +04:00
return c ;
}
static bool prepare_lookup_params ( struct libnet_context * ctx ,
struct composite_context * c ,
struct lookup_name_state * s )
{
const int single_name = 1 ;
s - > sids . count = 0 ;
s - > sids . sids = NULL ;
s - > names = talloc_array ( ctx , struct lsa_String , single_name ) ;
if ( composite_nomem ( s - > names , c ) ) return false ;
s - > names [ 0 ] . string = s - > name ;
s - > lookup . in . handle = & ctx - > lsa . handle ;
s - > lookup . in . num_names = single_name ;
s - > lookup . in . names = s - > names ;
s - > lookup . in . sids = & s - > sids ;
s - > lookup . in . level = 1 ;
s - > lookup . in . count = & s - > count ;
s - > lookup . out . count = & s - > count ;
s - > lookup . out . sids = & s - > sids ;
2008-10-24 15:43:21 +04:00
s - > lookup . out . domains = talloc_zero ( ctx , struct lsa_RefDomainList * ) ;
if ( composite_nomem ( s - > lookup . out . domains , c ) ) return false ;
2006-08-28 00:37:23 +04:00
return true ;
}
static void continue_lookup_name ( struct composite_context * ctx )
{
struct composite_context * c ;
struct lookup_name_state * s ;
2010-03-09 18:59:33 +03:00
struct tevent_req * subreq ;
2006-08-28 00:37:23 +04:00
c = talloc_get_type ( ctx - > async . private_data , struct composite_context ) ;
s = talloc_get_type ( c - > private_data , struct lookup_name_state ) ;
c - > status = libnet_DomainOpen_recv ( ctx , s - > ctx , c , & s - > domopen ) ;
if ( ! composite_is_ok ( c ) ) return ;
if ( ! prepare_lookup_params ( s - > ctx , c , s ) ) return ;
2010-03-09 18:59:33 +03:00
subreq = dcerpc_lsa_LookupNames_r_send ( s , c - > event_ctx ,
s - > ctx - > lsa . pipe - > binding_handle ,
& s - > lookup ) ;
if ( composite_nomem ( subreq , c ) ) return ;
2006-08-28 00:37:23 +04:00
2010-03-09 18:59:33 +03:00
tevent_req_set_callback ( subreq , continue_name_found , c ) ;
2006-08-28 00:37:23 +04:00
}
2010-03-09 18:59:33 +03:00
static void continue_name_found ( struct tevent_req * subreq )
2006-08-28 00:37:23 +04:00
{
struct composite_context * c ;
struct lookup_name_state * s ;
2010-03-09 18:59:33 +03:00
c = tevent_req_callback_data ( subreq , struct composite_context ) ;
2006-08-28 00:37:23 +04:00
s = talloc_get_type ( c - > private_data , struct lookup_name_state ) ;
2010-03-09 18:59:33 +03:00
c - > status = dcerpc_lsa_LookupNames_r_recv ( subreq , s ) ;
TALLOC_FREE ( subreq ) ;
2006-08-28 00:37:23 +04:00
if ( ! composite_is_ok ( c ) ) return ;
2006-12-15 01:45:12 +03:00
c - > status = s - > lookup . out . result ;
2006-12-15 14:07:35 +03:00
if ( ! composite_is_ok ( c ) ) return ;
2006-12-15 01:45:12 +03:00
2006-08-28 00:37:23 +04:00
composite_done ( c ) ;
}
NTSTATUS libnet_LookupName_recv ( struct composite_context * c , TALLOC_CTX * mem_ctx ,
struct libnet_LookupName * io )
{
NTSTATUS status ;
struct lookup_name_state * s ;
status = composite_wait ( c ) ;
if ( NT_STATUS_IS_OK ( status ) ) {
s = talloc_get_type ( c - > private_data , struct lookup_name_state ) ;
2006-12-14 11:23:55 +03:00
2006-08-28 00:37:23 +04:00
io - > out . rid = 0 ;
2006-12-14 11:23:55 +03:00
io - > out . sid = NULL ;
2006-08-28 00:37:23 +04:00
io - > out . sidstr = NULL ;
if ( * s - > lookup . out . count > 0 ) {
2008-10-24 15:43:21 +04:00
struct lsa_RefDomainList * domains = * s - > lookup . out . domains ;
2006-08-28 00:37:23 +04:00
struct lsa_TransSidArray * sids = s - > lookup . out . sids ;
2006-12-17 16:01:35 +03:00
if ( domains = = NULL | | sids = = NULL ) {
2006-12-17 16:33:43 +03:00
status = NT_STATUS_UNSUCCESSFUL ;
io - > out . error_string = talloc_asprintf ( mem_ctx , " Error: %s " , nt_errstr ( status ) ) ;
goto done ;
2006-12-17 16:01:35 +03:00
}
2006-08-28 00:37:23 +04:00
2006-12-14 02:35:50 +03:00
if ( sids - > count > 0 ) {
io - > out . rid = sids - > sids [ 0 ] . rid ;
io - > out . sid_type = sids - > sids [ 0 ] . sid_type ;
2006-12-14 11:23:55 +03:00
if ( domains - > count > 0 ) {
io - > out . sid = dom_sid_add_rid ( mem_ctx , domains - > domains [ 0 ] . sid , io - > out . rid ) ;
NT_STATUS_HAVE_NO_MEMORY ( io - > out . sid ) ;
io - > out . sidstr = dom_sid_string ( mem_ctx , io - > out . sid ) ;
NT_STATUS_HAVE_NO_MEMORY ( io - > out . sidstr ) ;
}
2006-12-14 02:35:50 +03:00
}
2006-08-28 00:37:23 +04:00
}
io - > out . error_string = talloc_strdup ( mem_ctx , " Success " ) ;
} else if ( ! NT_STATUS_IS_OK ( status ) ) {
io - > out . error_string = talloc_asprintf ( mem_ctx , " Error: %s " , nt_errstr ( status ) ) ;
}
2006-12-17 16:33:43 +03:00
done :
2006-12-14 11:23:55 +03:00
talloc_free ( c ) ;
2006-08-28 00:37:23 +04:00
return status ;
}
NTSTATUS libnet_LookupName ( struct libnet_context * ctx , TALLOC_CTX * mem_ctx ,
struct libnet_LookupName * io )
{
struct composite_context * c ;
c = libnet_LookupName_send ( ctx , mem_ctx , io , NULL ) ;
return libnet_LookupName_recv ( c , mem_ctx , io ) ;
}