1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r18019: Fix a C++ warnings: Don't use void * in libads/ for LDAPMessage anymore.

Compiled it on systems with and without LDAP, I hope it does not break the
build farm too badly. If it does, I'll fix it tomorrow.

Volker
This commit is contained in:
Volker Lendecke 2006-09-03 21:07:16 +00:00 committed by Gerald (Jerry) Carter
parent 8e087b7e46
commit b2ff9680eb
18 changed files with 262 additions and 157 deletions

View File

@ -15,7 +15,11 @@ enum wb_posix_mapping {
}; };
typedef struct { typedef struct {
#ifdef HAVE_LDAP
LDAP *ld;
#else
void *ld; /* the active ldap structure */ void *ld; /* the active ldap structure */
#endif
struct in_addr ldap_ip; /* the ip of the active connection, if any */ struct in_addr ldap_ip; /* the ip of the active connection, if any */
time_t last_attempt; /* last attempt to reconnect */ time_t last_attempt; /* last attempt to reconnect */
int ldap_port; int ldap_port;

View File

@ -0,0 +1,89 @@
/*
* Prototypes for ads
*/
void ads_msgfree(ADS_STRUCT *ads, LDAPMessage *msg);
char *ads_get_dn(ADS_STRUCT *ads, LDAPMessage *msg);
char *ads_get_dn_canonical(ADS_STRUCT *ads, LDAPMessage *msg);
char *ads_pull_string(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, LDAPMessage *msg,
const char *field);
char **ads_pull_strings(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
LDAPMessage *msg, const char *field,
size_t *num_values);
char **ads_pull_strings_range(ADS_STRUCT *ads,
TALLOC_CTX *mem_ctx,
LDAPMessage *msg, const char *field,
char **current_strings,
const char **next_attribute,
size_t *num_strings,
BOOL *more_strings);
BOOL ads_pull_uint32(ADS_STRUCT *ads, LDAPMessage *msg, const char *field,
uint32 *v);
BOOL ads_pull_guid(ADS_STRUCT *ads, LDAPMessage *msg, struct uuid *guid);
BOOL ads_pull_sid(ADS_STRUCT *ads, LDAPMessage *msg, const char *field,
DOM_SID *sid);
int ads_pull_sids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
LDAPMessage *msg, const char *field, DOM_SID **sids);
BOOL ads_pull_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
LDAPMessage *msg, const char *field, SEC_DESC **sd);
char *ads_pull_username(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
LDAPMessage *msg);
int ads_pull_sids_from_extendeddn(ADS_STRUCT *ads,
TALLOC_CTX *mem_ctx,
LDAPMessage *msg,
const char *field,
enum ads_extended_dn_flags flags,
DOM_SID **sids);
ADS_STATUS ads_find_machine_acct(ADS_STRUCT *ads, LDAPMessage **res,
const char *machine);
ADS_STATUS ads_find_printer_on_server(ADS_STRUCT *ads, LDAPMessage **res,
const char *printer,
const char *servername);
ADS_STATUS ads_find_printers(ADS_STRUCT *ads, LDAPMessage **res);
ADS_STATUS ads_find_user_acct(ADS_STRUCT *ads, LDAPMessage **res,
const char *user);
ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope,
const char *expr,
const char **attrs, LDAPMessage **res);
ADS_STATUS ads_search(ADS_STRUCT *ads, LDAPMessage **res,
const char *expr, const char **attrs);
ADS_STATUS ads_search_dn(ADS_STRUCT *ads, LDAPMessage **res,
const char *dn, const char **attrs);
ADS_STATUS ads_do_search_all_args(ADS_STRUCT *ads, const char *bind_path,
int scope, const char *expr,
const char **attrs, void *args,
LDAPMessage **res);
ADS_STATUS ads_do_search_all(ADS_STRUCT *ads, const char *bind_path,
int scope, const char *expr,
const char **attrs, LDAPMessage **res);
ADS_STATUS ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path,
int scope,
const char *expr,
const char **attrs, LDAPMessage **res);
ADS_STATUS ads_do_search_retry_args(ADS_STRUCT *ads, const char *bind_path,
int scope, const char *expr,
const char **attrs, void *args,
LDAPMessage **res);
ADS_STATUS ads_search_retry(ADS_STRUCT *ads, LDAPMessage **res,
const char *expr, const char **attrs);
ADS_STATUS ads_search_retry_dn(ADS_STRUCT *ads, LDAPMessage **res,
const char *dn,
const char **attrs);
ADS_STATUS ads_search_retry_extended_dn(ADS_STRUCT *ads, LDAPMessage **res,
const char *dn,
const char **attrs,
enum ads_extended_dn_flags flags);
ADS_STATUS ads_search_retry_sid(ADS_STRUCT *ads, LDAPMessage **res,
const DOM_SID *sid,
const char **attrs);
LDAPMessage *ads_first_entry(ADS_STRUCT *ads, LDAPMessage *res);
LDAPMessage *ads_next_entry(ADS_STRUCT *ads, LDAPMessage *res);
void ads_process_results(ADS_STRUCT *ads, LDAPMessage *res,
BOOL(*fn)(char *, void **, void *),
void *data_area);
void ads_dump(ADS_STRUCT *ads, LDAPMessage *res);

View File

@ -1084,6 +1084,10 @@ typedef int (*comparison_fn_t)(const void *, const void *);
#include "proto.h" #include "proto.h"
#endif #endif
#ifdef HAVE_ADS
#include "ads_protos.h"
#endif
/* We need this after proto.h to reference GetTimeOfDay(). */ /* We need this after proto.h to reference GetTimeOfDay(). */
#include "smbprofile.h" #include "smbprofile.h"

View File

@ -410,6 +410,7 @@ struct fd_handle {
struct timed_event; struct timed_event;
struct idle_event; struct idle_event;
struct share_mode_entry; struct share_mode_entry;
struct uuid;
struct vfs_fsp_data { struct vfs_fsp_data {
struct vfs_fsp_data *next; struct vfs_fsp_data *next;

View File

@ -445,7 +445,7 @@ int32 DNSCopyDomainName( uint8 * pBuffer, DNS_DOMAIN_NAME * pDomainName, int32 *
int32 DNSAllocateString( char *pszInputString, char **ppszOutputString ); int32 DNSAllocateString( char *pszInputString, char **ppszOutputString );
int32 DNSGenerateKeyName( char **pszKeyName ); int32 DNSGenerateKeyName( char **pszKeyName );
int32 DNSMakeRRHeader( DNS_RR_HEADER * pDNSRR, char *szOwnerName, int16 wType, int32 dwTTL ); int32 DNSMakeRRHeader( DNS_RR_HEADER * pDNSRR, char *szOwnerName, int16 wType, int32 dwTTL );
int32 DNSDomainNameFromString( char *pszDomainName, DNS_DOMAIN_NAME ** ppDomainName ); int32 DNSDomainNameFromString( const char *pszDomainName, DNS_DOMAIN_NAME ** ppDomainName );
int32 DNSAppendLabel( DNS_DOMAIN_LABEL * pLabelList, DNS_DOMAIN_LABEL * pLabel, DNS_DOMAIN_LABEL ** ppNewLabelList ); int32 DNSAppendLabel( DNS_DOMAIN_LABEL * pLabelList, DNS_DOMAIN_LABEL * pLabel, DNS_DOMAIN_LABEL ** ppNewLabelList );
int32 DNSGenerateKeyName( char **ppszKeyName ); int32 DNSGenerateKeyName( char **ppszKeyName );
void DNSRecordGenerateOffsets( DNS_RR_RECORD * pDNSRecord ); void DNSRecordGenerateOffsets( DNS_RR_RECORD * pDNSRecord );
@ -470,7 +470,7 @@ int32 DNSAddQuestionSection( DNS_REQUEST * pDNSRequest, DNS_QUESTION_RECORD * pD
int32 DNSAddAdditionalSection( DNS_REQUEST * pDNSRequest, DNS_RR_RECORD * pDNSRecord ); int32 DNSAddAdditionalSection( DNS_REQUEST * pDNSRequest, DNS_RR_RECORD * pDNSRecord );
int32 DNSAddAnswerSection( DNS_REQUEST * pDNSRequest, DNS_RR_RECORD * pDNSRecord ); int32 DNSAddAnswerSection( DNS_REQUEST * pDNSRequest, DNS_RR_RECORD * pDNSRecord );
int32 DNSAddAuthoritySection( DNS_REQUEST * pDNSRequest, DNS_RR_RECORD * pDNSRecord ); int32 DNSAddAuthoritySection( DNS_REQUEST * pDNSRequest, DNS_RR_RECORD * pDNSRecord );
int32 DNSCreateZoneRecord( char *pszZName, DNS_ZONE_RECORD ** ppDNSZoneRecord ); int32 DNSCreateZoneRecord( const char *pszZName, DNS_ZONE_RECORD ** ppDNSZoneRecord );
int32 DNSFreeZoneRecord( DNS_ZONE_RECORD * pDNSZoneRecord ); int32 DNSFreeZoneRecord( DNS_ZONE_RECORD * pDNSZoneRecord );
int32 DNSCreateNameInUseRecord( char *pszName, int32 qtype, struct in_addr *addr, DNS_RR_RECORD ** ppDNSRRRecord ); int32 DNSCreateNameInUseRecord( char *pszName, int32 qtype, struct in_addr *addr, DNS_RR_RECORD ** ppDNSRRRecord );
int32 DNSCreateNameNotInUseRecord( char *pszName, int32 qtype, DNS_RR_RECORD ** ppDNSRRRecord ); int32 DNSCreateNameNotInUseRecord( char *pszName, int32 qtype, DNS_RR_RECORD ** ppDNSRRRecord );
@ -545,7 +545,7 @@ int32 DNSNegotiateContextAndSecureUpdate( HANDLE hDNSServer, char *szServiceName
/* from dnsupdate.c */ /* from dnsupdate.c */
int32 DNSSendUpdate( HANDLE hDNSServer, char *szDomainName, char *szHost, struct in_addr *iplist, int num_addrs, DNS_UPDATE_RESPONSE ** ppDNSUpdateResponse ); int32 DNSSendUpdate( HANDLE hDNSServer, const char *szDomainName, char *szHost, struct in_addr *iplist, int num_addrs, DNS_UPDATE_RESPONSE ** ppDNSUpdateResponse );
int32 DNSBuildSignatureBuffer( int32 dwMaxSignatureSize, uint8 ** ppSignature ); int32 DNSBuildSignatureBuffer( int32 dwMaxSignatureSize, uint8 ** ppSignature );
int32 DNSBuildMessageBuffer( DNS_UPDATE_REQUEST * pDNSUpdateRequest, char *szKeyName, int32 * pdwTimeSigned, int16 * pwFudge, uint8 ** ppMessageBuffer, int32 * pdwMessageSize ); int32 DNSBuildMessageBuffer( DNS_UPDATE_REQUEST * pDNSUpdateRequest, char *szKeyName, int32 * pdwTimeSigned, int16 * pwFudge, uint8 ** ppMessageBuffer, int32 * pdwMessageSize );
int32 DNSClose( HANDLE hDNSUpdate ); int32 DNSClose( HANDLE hDNSUpdate );

View File

@ -412,7 +412,7 @@ int32 DNSCreateQuestionRecord( char *pszQName, int16 wQType,
/********************************************************************* /*********************************************************************
*********************************************************************/ *********************************************************************/
int32 DNSCreateZoneRecord( char *pszZName, DNS_ZONE_RECORD ** ppDNSZoneRecord ) int32 DNSCreateZoneRecord( const char *pszZName, DNS_ZONE_RECORD ** ppDNSZoneRecord )
{ {
int32 dwError = 0; int32 dwError = 0;
DNS_ZONE_RECORD *pDNSZoneRecord = NULL; DNS_ZONE_RECORD *pDNSZoneRecord = NULL;

View File

@ -29,7 +29,7 @@
/******************************************************************** /********************************************************************
********************************************************************/ ********************************************************************/
static int32 DNSSendUpdate1( HANDLE hDNSServer, char *szDomainName, static int32 DNSSendUpdate1( HANDLE hDNSServer, const char *szDomainName,
char *szHost, struct in_addr *iplist, char *szHost, struct in_addr *iplist,
int num_ips, int num_ips,
DNS_UPDATE_RESPONSE * *ppDNSUpdateResponse ) DNS_UPDATE_RESPONSE * *ppDNSUpdateResponse )
@ -108,7 +108,7 @@ static int32 DNSSendUpdate1( HANDLE hDNSServer, char *szDomainName,
/******************************************************************** /********************************************************************
********************************************************************/ ********************************************************************/
static int32 DNSSendUpdate2( HANDLE hDNSServer, char *szDomainName, static int32 DNSSendUpdate2( HANDLE hDNSServer, const char *szDomainName,
char *szHost, struct in_addr *iplist, char *szHost, struct in_addr *iplist,
int num_ips, int num_ips,
DNS_UPDATE_RESPONSE * *ppDNSUpdateResponse ) DNS_UPDATE_RESPONSE * *ppDNSUpdateResponse )
@ -197,7 +197,7 @@ static int32 DNSSendUpdate2( HANDLE hDNSServer, char *szDomainName,
/******************************************************************** /********************************************************************
********************************************************************/ ********************************************************************/
static int32 DNSSendUpdate3( HANDLE hDNSServer, char *szDomainName, static int32 DNSSendUpdate3( HANDLE hDNSServer, const char *szDomainName,
char *szHost, struct in_addr *iplist, char *szHost, struct in_addr *iplist,
int num_ips, int num_ips,
DNS_UPDATE_RESPONSE * *ppDNSUpdateResponse ) DNS_UPDATE_RESPONSE * *ppDNSUpdateResponse )
@ -288,7 +288,7 @@ static int32 DNSSendUpdate3( HANDLE hDNSServer, char *szDomainName,
/******************************************************************** /********************************************************************
********************************************************************/ ********************************************************************/
int32 DNSSendUpdate( HANDLE hDNSServer, char *szDomainName, char *szHost, int32 DNSSendUpdate( HANDLE hDNSServer, const char *szDomainName, char *szHost,
struct in_addr * iplist, int num_ips, struct in_addr * iplist, int num_ips,
DNS_UPDATE_RESPONSE * *ppDNSUpdateResponse ) DNS_UPDATE_RESPONSE * *ppDNSUpdateResponse )
{ {

View File

@ -41,7 +41,7 @@
/********************************************************************* /*********************************************************************
*********************************************************************/ *********************************************************************/
static int32 getToken( char *pszString, char *pszToken, int32 * pdwToken, static int32 getToken( const char *pszString, char *pszToken, int32 * pdwToken,
int32 * pdwPosition ) int32 * pdwPosition )
{ {
int32 dwError = 0; int32 dwError = 0;
@ -167,7 +167,7 @@ void DNSFreeDomainName(DNS_DOMAIN_NAME *pDomainName)
/********************************************************************* /*********************************************************************
*********************************************************************/ *********************************************************************/
static int32 LabelList( char *pszString, int32 * pdwPosition, DNS_DOMAIN_LABEL ** ppList ) static int32 LabelList( const char *pszString, int32 * pdwPosition, DNS_DOMAIN_LABEL ** ppList )
{ {
int32 dwError = 0; int32 dwError = 0;
DNS_DOMAIN_LABEL *pList = NULL; DNS_DOMAIN_LABEL *pList = NULL;
@ -358,7 +358,7 @@ int32 DNSGenerateKeyName( char **ppszKeyName )
/********************************************************************* /*********************************************************************
*********************************************************************/ *********************************************************************/
int32 DNSDomainNameFromString( char *pszDomainName, int32 DNSDomainNameFromString( const char *pszDomainName,
DNS_DOMAIN_NAME ** ppDomainName ) DNS_DOMAIN_NAME ** ppDomainName )
{ {
int32 dwError = 0; int32 dwError = 0;

View File

@ -438,7 +438,8 @@ static struct berval *dup_berval(TALLOC_CTX *ctx, const struct berval *in_val)
if (in_val->bv_len == 0) return value; if (in_val->bv_len == 0) return value;
value->bv_len = in_val->bv_len; value->bv_len = in_val->bv_len;
value->bv_val = TALLOC_MEMDUP(ctx, in_val->bv_val, in_val->bv_len); value->bv_val = (char *)TALLOC_MEMDUP(ctx, in_val->bv_val,
in_val->bv_len);
return value; return value;
} }
@ -517,10 +518,12 @@ static char **ads_pull_strvals(TALLOC_CTX *ctx, const char **in_vals)
* @param cookie The paged results cookie to be returned on subsequent calls * @param cookie The paged results cookie to be returned on subsequent calls
* @return status of search * @return status of search
**/ **/
ADS_STATUS ads_do_paged_search_args(ADS_STRUCT *ads, const char *bind_path, static ADS_STATUS ads_do_paged_search_args(ADS_STRUCT *ads,
int scope, const char *expr, const char *bind_path,
const char **attrs, void *args, void **res, int scope, const char *expr,
int *count, void **cookie) const char **attrs, void *args,
LDAPMessage **res,
int *count, struct berval **cookie)
{ {
int rc, i, version; int rc, i, version;
char *utf8_expr, *utf8_path, **search_attrs; char *utf8_expr, *utf8_path, **search_attrs;
@ -693,10 +696,10 @@ done:
return ADS_ERROR(rc); return ADS_ERROR(rc);
} }
ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path, static ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path,
int scope, const char *expr, int scope, const char *expr,
const char **attrs, void **res, const char **attrs, LDAPMessage **res,
int *count, void **cookie) int *count, struct berval **cookie)
{ {
return ads_do_paged_search_args(ads, bind_path, scope, expr, attrs, NULL, res, count, cookie); return ads_do_paged_search_args(ads, bind_path, scope, expr, attrs, NULL, res, count, cookie);
} }
@ -713,11 +716,12 @@ ADS_STATUS ads_do_paged_search(ADS_STRUCT *ads, const char *bind_path,
* @param res ** which will contain results - free res* with ads_msgfree() * @param res ** which will contain results - free res* with ads_msgfree()
* @return status of search * @return status of search
**/ **/
ADS_STATUS ads_do_search_all_args(ADS_STRUCT *ads, const char *bind_path, ADS_STATUS ads_do_search_all_args(ADS_STRUCT *ads, const char *bind_path,
int scope, const char *expr, int scope, const char *expr,
const char **attrs, void *args, void **res) const char **attrs, void *args,
LDAPMessage **res)
{ {
void *cookie = NULL; struct berval *cookie = NULL;
int count = 0; int count = 0;
ADS_STATUS status; ADS_STATUS status;
@ -730,7 +734,7 @@ ADS_STATUS ads_do_search_all_args(ADS_STRUCT *ads, const char *bind_path,
#ifdef HAVE_LDAP_ADD_RESULT_ENTRY #ifdef HAVE_LDAP_ADD_RESULT_ENTRY
while (cookie) { while (cookie) {
void *res2 = NULL; LDAPMessage *res2 = NULL;
ADS_STATUS status2; ADS_STATUS status2;
LDAPMessage *msg, *next; LDAPMessage *msg, *next;
@ -756,9 +760,9 @@ ADS_STATUS ads_do_search_all_args(ADS_STRUCT *ads, const char *bind_path,
return status; return status;
} }
ADS_STATUS ads_do_search_all(ADS_STRUCT *ads, const char *bind_path, ADS_STATUS ads_do_search_all(ADS_STRUCT *ads, const char *bind_path,
int scope, const char *expr, int scope, const char *expr,
const char **attrs, void **res) const char **attrs, LDAPMessage **res)
{ {
return ads_do_search_all_args(ads, bind_path, scope, expr, attrs, NULL, res); return ads_do_search_all_args(ads, bind_path, scope, expr, attrs, NULL, res);
} }
@ -780,10 +784,10 @@ ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
BOOL(*fn)(char *, void **, void *), BOOL(*fn)(char *, void **, void *),
void *data_area) void *data_area)
{ {
void *cookie = NULL; struct berval *cookie = NULL;
int count = 0; int count = 0;
ADS_STATUS status; ADS_STATUS status;
void *res; LDAPMessage *res;
status = ads_do_paged_search(ads, bind_path, scope, expr, attrs, &res, status = ads_do_paged_search(ads, bind_path, scope, expr, attrs, &res,
&count, &cookie); &count, &cookie);
@ -816,9 +820,9 @@ ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
* @param res ** which will contain results - free res* with ads_msgfree() * @param res ** which will contain results - free res* with ads_msgfree()
* @return status of search * @return status of search
**/ **/
ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope, ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope,
const char *expr, const char *expr,
const char **attrs, void **res) const char **attrs, LDAPMessage **res)
{ {
int rc; int rc;
char *utf8_expr, *utf8_path, **search_attrs = NULL; char *utf8_expr, *utf8_path, **search_attrs = NULL;
@ -880,9 +884,8 @@ ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope,
* @param attrs Attributes to retrieve * @param attrs Attributes to retrieve
* @return status of search * @return status of search
**/ **/
ADS_STATUS ads_search(ADS_STRUCT *ads, void **res, ADS_STATUS ads_search(ADS_STRUCT *ads, LDAPMessage **res,
const char *expr, const char *expr, const char **attrs)
const char **attrs)
{ {
return ads_do_search(ads, ads->config.bind_path, LDAP_SCOPE_SUBTREE, return ads_do_search(ads, ads->config.bind_path, LDAP_SCOPE_SUBTREE,
expr, attrs, res); expr, attrs, res);
@ -896,12 +899,11 @@ ADS_STATUS ads_search(ADS_STRUCT *ads, void **res,
* @param attrs Attributes to retrieve * @param attrs Attributes to retrieve
* @return status of search * @return status of search
**/ **/
ADS_STATUS ads_search_dn(ADS_STRUCT *ads, void *_res, ADS_STATUS ads_search_dn(ADS_STRUCT *ads, LDAPMessage **res,
const char *dn, const char *dn, const char **attrs)
const char **attrs)
{ {
void **res = (void **)_res; return ads_do_search(ads, dn, LDAP_SCOPE_BASE, "(objectclass=*)",
return ads_do_search(ads, dn, LDAP_SCOPE_BASE, "(objectclass=*)", attrs, res); attrs, res);
} }
/** /**
@ -909,7 +911,7 @@ ADS_STATUS ads_search_dn(ADS_STRUCT *ads, void *_res,
* @param ads connection to ads server * @param ads connection to ads server
* @param msg Search results to free * @param msg Search results to free
**/ **/
void ads_msgfree(ADS_STRUCT *ads, void *msg) void ads_msgfree(ADS_STRUCT *ads, LDAPMessage *msg)
{ {
if (!msg) return; if (!msg) return;
ldap_msgfree(msg); ldap_msgfree(msg);
@ -931,7 +933,7 @@ void ads_memfree(ADS_STRUCT *ads, void *mem)
* @param msg Search result * @param msg Search result
* @return dn string * @return dn string
**/ **/
char *ads_get_dn(ADS_STRUCT *ads, void *msg) char *ads_get_dn(ADS_STRUCT *ads, LDAPMessage *msg)
{ {
char *utf8_dn, *unix_dn; char *utf8_dn, *unix_dn;
@ -957,7 +959,7 @@ char *ads_get_dn(ADS_STRUCT *ads, void *msg)
* @param msg Search result * @param msg Search result
* @return dn string * @return dn string
**/ **/
char *ads_get_dn_canonical(ADS_STRUCT *ads, void *msg) char *ads_get_dn_canonical(ADS_STRUCT *ads, LDAPMessage *msg)
{ {
#ifdef HAVE_LDAP_DN2AD_CANONICAL #ifdef HAVE_LDAP_DN2AD_CANONICAL
return ldap_dn2ad_canonical(ads_get_dn(ads, msg)); return ldap_dn2ad_canonical(ads_get_dn(ads, msg));
@ -995,7 +997,8 @@ char *ads_parent_dn(const char *dn)
* @param host Hostname to search for * @param host Hostname to search for
* @return status of search * @return status of search
**/ **/
ADS_STATUS ads_find_machine_acct(ADS_STRUCT *ads, void **res, const char *machine) ADS_STATUS ads_find_machine_acct(ADS_STRUCT *ads, LDAPMessage **res,
const char *machine)
{ {
ADS_STATUS status; ADS_STATUS status;
char *expr; char *expr;
@ -1271,7 +1274,7 @@ char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit)
char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid) char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid)
{ {
ADS_STATUS status; ADS_STATUS status;
void *res; LDAPMessage *res;
char *base, *wkn_dn, *ret, **wkn_dn_exp, **bind_dn_exp; char *base, *wkn_dn, *ret, **wkn_dn_exp, **bind_dn_exp;
const char *attrs[] = {"distinguishedName", NULL}; const char *attrs[] = {"distinguishedName", NULL};
int new_ln, wkn_ln, bind_ln, i; int new_ln, wkn_ln, bind_ln, i;
@ -1338,7 +1341,8 @@ char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid)
ADS_STATUS ads_add_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods, ADS_STATUS ads_add_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
const char *name, const char **vals) const char *name, const char **vals)
{ {
return ads_modlist_add(ctx, mods, LDAP_MOD_ADD, name, (const void **) vals); return ads_modlist_add(ctx, mods, LDAP_MOD_ADD, name,
(const void *) vals);
} }
/** /**
@ -1361,7 +1365,7 @@ uint32 ads_get_kvno(ADS_STRUCT *ads, const char *machine_name)
if (asprintf(&filter, "(samAccountName=%s$)", machine_name) == -1) { if (asprintf(&filter, "(samAccountName=%s$)", machine_name) == -1) {
return kvno; return kvno;
} }
ret = ads_search(ads, (void**)(void *)&res, filter, attrs); ret = ads_search(ads, &res, filter, attrs);
SAFE_FREE(filter); SAFE_FREE(filter);
if (!ADS_ERR_OK(ret) && ads_count_replies(ads, res)) { if (!ADS_ERR_OK(ret) && ads_count_replies(ads, res)) {
DEBUG(1,("ads_get_kvno: Computer Account For %s not found.\n", machine_name)); DEBUG(1,("ads_get_kvno: Computer Account For %s not found.\n", machine_name));
@ -1415,7 +1419,7 @@ ADS_STATUS ads_clear_service_principal_names(ADS_STRUCT *ads, const char *machin
ADS_STATUS ret = ADS_ERROR(LDAP_SUCCESS); ADS_STATUS ret = ADS_ERROR(LDAP_SUCCESS);
char *dn_string = NULL; char *dn_string = NULL;
ret = ads_find_machine_acct(ads, (void **)(void *)&res, machine_name); ret = ads_find_machine_acct(ads, &res, machine_name);
if (!ADS_ERR_OK(ret) || ads_count_replies(ads, res) != 1) { if (!ADS_ERR_OK(ret) || ads_count_replies(ads, res) != 1) {
DEBUG(5,("ads_clear_service_principal_names: WARNING: Host Account for %s not found... skipping operation.\n", machine_name)); DEBUG(5,("ads_clear_service_principal_names: WARNING: Host Account for %s not found... skipping operation.\n", machine_name));
DEBUG(5,("ads_clear_service_principal_names: WARNING: Service Principals for %s have NOT been cleared.\n", machine_name)); DEBUG(5,("ads_clear_service_principal_names: WARNING: Service Principals for %s have NOT been cleared.\n", machine_name));
@ -1484,7 +1488,7 @@ ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_n
char *dn_string = NULL; char *dn_string = NULL;
const char *servicePrincipalName[3] = {NULL, NULL, NULL}; const char *servicePrincipalName[3] = {NULL, NULL, NULL};
ret = ads_find_machine_acct(ads, (void **)(void *)&res, machine_name); ret = ads_find_machine_acct(ads, &res, machine_name);
if (!ADS_ERR_OK(ret) || ads_count_replies(ads, res) != 1) { if (!ADS_ERR_OK(ret) || ads_count_replies(ads, res) != 1) {
DEBUG(1,("ads_add_service_principal_name: WARNING: Host Account for %s not found... skipping operation.\n", DEBUG(1,("ads_add_service_principal_name: WARNING: Host Account for %s not found... skipping operation.\n",
machine_name)); machine_name));
@ -1751,7 +1755,7 @@ static BOOL ads_dump_field(char *field, void **values, void *data_area)
* @param res Results to dump * @param res Results to dump
**/ **/
void ads_dump(ADS_STRUCT *ads, void *res) void ads_dump(ADS_STRUCT *ads, LDAPMessage *res)
{ {
ads_process_results(ads, res, ads_dump_field, NULL); ads_process_results(ads, res, ads_dump_field, NULL);
} }
@ -1767,11 +1771,11 @@ void ads_dump(ADS_STRUCT *ads, void *res)
* @param fn Function for processing each result * @param fn Function for processing each result
* @param data_area user-defined area to pass to function * @param data_area user-defined area to pass to function
**/ **/
void ads_process_results(ADS_STRUCT *ads, void *res, void ads_process_results(ADS_STRUCT *ads, LDAPMessage *res,
BOOL(*fn)(char *, void **, void *), BOOL(*fn)(char *, void **, void *),
void *data_area) void *data_area)
{ {
void *msg; LDAPMessage *msg;
TALLOC_CTX *ctx; TALLOC_CTX *ctx;
if (!(ctx = talloc_init("ads_process_results"))) if (!(ctx = talloc_init("ads_process_results")))
@ -1836,9 +1840,9 @@ int ads_count_replies(ADS_STRUCT *ads, void *res)
* @param res Results of search * @param res Results of search
* @return first entry from result * @return first entry from result
**/ **/
void *ads_first_entry(ADS_STRUCT *ads, void *res) LDAPMessage *ads_first_entry(ADS_STRUCT *ads, LDAPMessage *res)
{ {
return (void *)ldap_first_entry(ads->ld, (LDAPMessage *)res); return ldap_first_entry(ads->ld, res);
} }
/** /**
@ -1847,9 +1851,9 @@ void *ads_first_entry(ADS_STRUCT *ads, void *res)
* @param res Results of search * @param res Results of search
* @return next entry from result * @return next entry from result
**/ **/
void *ads_next_entry(ADS_STRUCT *ads, void *res) LDAPMessage *ads_next_entry(ADS_STRUCT *ads, LDAPMessage *res)
{ {
return (void *)ldap_next_entry(ads->ld, (LDAPMessage *)res); return ldap_next_entry(ads->ld, res);
} }
/** /**
@ -1860,8 +1864,8 @@ void *ads_next_entry(ADS_STRUCT *ads, void *res)
* @param field Attribute to retrieve * @param field Attribute to retrieve
* @return Result string in talloc context * @return Result string in talloc context
**/ **/
char *ads_pull_string(ADS_STRUCT *ads, char *ads_pull_string(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, LDAPMessage *msg,
TALLOC_CTX *mem_ctx, void *msg, const char *field) const char *field)
{ {
char **values; char **values;
char *ret = NULL; char *ret = NULL;
@ -1891,9 +1895,9 @@ char *ads_pull_string(ADS_STRUCT *ads,
* @param field Attribute to retrieve * @param field Attribute to retrieve
* @return Result strings in talloc context * @return Result strings in talloc context
**/ **/
char **ads_pull_strings(ADS_STRUCT *ads, char **ads_pull_strings(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
TALLOC_CTX *mem_ctx, void *msg, const char *field, LDAPMessage *msg, const char *field,
size_t *num_values) size_t *num_values)
{ {
char **values; char **values;
char **ret = NULL; char **ret = NULL;
@ -1936,13 +1940,13 @@ char **ads_pull_strings(ADS_STRUCT *ads,
* @param more_values Are there more values to get? * @param more_values Are there more values to get?
* @return Result strings in talloc context * @return Result strings in talloc context
**/ **/
char **ads_pull_strings_range(ADS_STRUCT *ads, char **ads_pull_strings_range(ADS_STRUCT *ads,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
void *msg, const char *field, LDAPMessage *msg, const char *field,
char **current_strings, char **current_strings,
const char **next_attribute, const char **next_attribute,
size_t *num_strings, size_t *num_strings,
BOOL *more_strings) BOOL *more_strings)
{ {
char *attr; char *attr;
char *expected_range_attrib, *range_attr; char *expected_range_attrib, *range_attr;
@ -2059,8 +2063,8 @@ char **ads_pull_strings_range(ADS_STRUCT *ads,
* @param v Pointer to int to store result * @param v Pointer to int to store result
* @return boolean inidicating success * @return boolean inidicating success
*/ */
BOOL ads_pull_uint32(ADS_STRUCT *ads, BOOL ads_pull_uint32(ADS_STRUCT *ads, LDAPMessage *msg, const char *field,
void *msg, const char *field, uint32 *v) uint32 *v)
{ {
char **values; char **values;
@ -2084,8 +2088,7 @@ BOOL ads_pull_uint32(ADS_STRUCT *ads,
* @param guid 37-byte area to receive text guid * @param guid 37-byte area to receive text guid
* @return boolean indicating success * @return boolean indicating success
**/ **/
BOOL ads_pull_guid(ADS_STRUCT *ads, BOOL ads_pull_guid(ADS_STRUCT *ads, LDAPMessage *msg, struct uuid *guid)
void *msg, struct uuid *guid)
{ {
char **values; char **values;
UUID_FLAT flat_guid; UUID_FLAT flat_guid;
@ -2114,8 +2117,8 @@ BOOL ads_pull_guid(ADS_STRUCT *ads,
* @param sid Pointer to sid to store result * @param sid Pointer to sid to store result
* @return boolean inidicating success * @return boolean inidicating success
*/ */
BOOL ads_pull_sid(ADS_STRUCT *ads, BOOL ads_pull_sid(ADS_STRUCT *ads, LDAPMessage *msg, const char *field,
void *msg, const char *field, DOM_SID *sid) DOM_SID *sid)
{ {
struct berval **values; struct berval **values;
BOOL ret = False; BOOL ret = False;
@ -2141,8 +2144,8 @@ BOOL ads_pull_sid(ADS_STRUCT *ads,
* @param sids pointer to sid array to allocate * @param sids pointer to sid array to allocate
* @return the count of SIDs pulled * @return the count of SIDs pulled
**/ **/
int ads_pull_sids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, int ads_pull_sids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
void *msg, const char *field, DOM_SID **sids) LDAPMessage *msg, const char *field, DOM_SID **sids)
{ {
struct berval **values; struct berval **values;
BOOL ret; BOOL ret;
@ -2185,8 +2188,8 @@ int ads_pull_sids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
* @param sd Pointer to *SEC_DESC to store result (talloc()ed) * @param sd Pointer to *SEC_DESC to store result (talloc()ed)
* @return boolean inidicating success * @return boolean inidicating success
*/ */
BOOL ads_pull_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, BOOL ads_pull_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
void *msg, const char *field, SEC_DESC **sd) LDAPMessage *msg, const char *field, SEC_DESC **sd)
{ {
struct berval **values; struct berval **values;
prs_struct ps; prs_struct ps;
@ -2218,7 +2221,8 @@ BOOL ads_pull_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
* @param msg Results of search * @param msg Results of search
* @return the username * @return the username
*/ */
char *ads_pull_username(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, void *msg) char *ads_pull_username(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
LDAPMessage *msg)
{ {
#if 0 /* JERRY */ #if 0 /* JERRY */
char *ret, *p; char *ret, *p;
@ -2248,7 +2252,7 @@ ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32 *usn)
{ {
const char *attrs[] = {"highestCommittedUSN", NULL}; const char *attrs[] = {"highestCommittedUSN", NULL};
ADS_STATUS status; ADS_STATUS status;
void *res; LDAPMessage *res;
status = ads_do_search_retry(ads, "", LDAP_SCOPE_BASE, "(objectclass=*)", attrs, &res); status = ads_do_search_retry(ads, "", LDAP_SCOPE_BASE, "(objectclass=*)", attrs, &res);
if (!ADS_ERR_OK(status)) if (!ADS_ERR_OK(status))
@ -2290,7 +2294,7 @@ ADS_STATUS ads_current_time(ADS_STRUCT *ads)
{ {
const char *attrs[] = {"currentTime", NULL}; const char *attrs[] = {"currentTime", NULL};
ADS_STATUS status; ADS_STATUS status;
void *res; LDAPMessage *res;
char *timestr; char *timestr;
TALLOC_CTX *ctx; TALLOC_CTX *ctx;
ADS_STRUCT *ads_s = ads; ADS_STRUCT *ads_s = ads;
@ -2355,7 +2359,7 @@ ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32 *val)
{ {
const char *attrs[] = {"domainFunctionality", NULL}; const char *attrs[] = {"domainFunctionality", NULL};
ADS_STATUS status; ADS_STATUS status;
void *res; LDAPMessage *res;
ADS_STRUCT *ads_s = ads; ADS_STRUCT *ads_s = ads;
*val = DS_DOMAIN_FUNCTION_2000; *val = DS_DOMAIN_FUNCTION_2000;
@ -2411,7 +2415,7 @@ done:
ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, DOM_SID *sid) ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, DOM_SID *sid)
{ {
const char *attrs[] = {"objectSid", NULL}; const char *attrs[] = {"objectSid", NULL};
void *res; LDAPMessage *res;
ADS_STATUS rc; ADS_STATUS rc;
rc = ads_do_search_retry(ads, ads->config.bind_path, LDAP_SCOPE_BASE, "(objectclass=*)", rc = ads_do_search_retry(ads, ads->config.bind_path, LDAP_SCOPE_BASE, "(objectclass=*)",
@ -2436,7 +2440,7 @@ ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, DOM_SID *sid)
ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_name) ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_name)
{ {
ADS_STATUS status; ADS_STATUS status;
void *res; LDAPMessage *res;
const char *dn, *service_name; const char *dn, *service_name;
const char *attrs[] = { "dsServiceName", NULL }; const char *attrs[] = { "dsServiceName", NULL };
@ -2480,7 +2484,7 @@ ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_n
ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site_dn) ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site_dn)
{ {
ADS_STATUS status; ADS_STATUS status;
void *res; LDAPMessage *res;
const char *parent, *config_context, *filter; const char *parent, *config_context, *filter;
const char *attrs[] = { "configurationNamingContext", NULL }; const char *attrs[] = { "configurationNamingContext", NULL };
char *dn; char *dn;
@ -2549,7 +2553,7 @@ ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const c
ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **suffixes, size_t *num_suffixes) ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **suffixes, size_t *num_suffixes)
{ {
ADS_STATUS status; ADS_STATUS status;
void *res; LDAPMessage *res;
const char *config_context, *base; const char *config_context, *base;
const char *attrs[] = { "configurationNamingContext", NULL }; const char *attrs[] = { "configurationNamingContext", NULL };
const char *attrs2[] = { "uPNSuffixes", NULL }; const char *attrs2[] = { "uPNSuffixes", NULL };
@ -2578,7 +2582,7 @@ ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **suffixe
return ADS_ERROR(LDAP_NO_SUCH_OBJECT); return ADS_ERROR(LDAP_NO_SUCH_OBJECT);
} }
suffixes = ads_pull_strings(ads, mem_ctx, &res, "uPNSuffixes", num_suffixes); suffixes = ads_pull_strings(ads, mem_ctx, res, "uPNSuffixes", num_suffixes);
if (suffixes == NULL) { if (suffixes == NULL) {
ads_msgfree(ads, res); ads_msgfree(ads, res);
return ADS_ERROR(LDAP_NO_MEMORY); return ADS_ERROR(LDAP_NO_MEMORY);
@ -2675,12 +2679,12 @@ BOOL ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
* @param sids pointer to sid array to allocate * @param sids pointer to sid array to allocate
* @return the count of SIDs pulled * @return the count of SIDs pulled
**/ **/
int ads_pull_sids_from_extendeddn(ADS_STRUCT *ads, int ads_pull_sids_from_extendeddn(ADS_STRUCT *ads,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
void *msg, LDAPMessage *msg,
const char *field, const char *field,
enum ads_extended_dn_flags flags, enum ads_extended_dn_flags flags,
DOM_SID **sids) DOM_SID **sids)
{ {
int i; int i;
size_t dn_count; size_t dn_count;
@ -2722,7 +2726,7 @@ char* ads_get_dnshostname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine
int count = 0; int count = 0;
char *name = NULL; char *name = NULL;
status = ads_find_machine_acct(ads, (void **)(void *)&res, global_myname()); status = ads_find_machine_acct(ads, &res, global_myname());
if (!ADS_ERR_OK(status)) { if (!ADS_ERR_OK(status)) {
DEBUG(0,("ads_get_dnshostname: Failed to find account for %s\n", DEBUG(0,("ads_get_dnshostname: Failed to find account for %s\n",
global_myname())); global_myname()));
@ -2754,7 +2758,7 @@ char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name )
int count = 0; int count = 0;
char *name = NULL; char *name = NULL;
status = ads_find_machine_acct(ads, (void **)(void *)&res, global_myname()); status = ads_find_machine_acct(ads, &res, global_myname());
if (!ADS_ERR_OK(status)) { if (!ADS_ERR_OK(status)) {
DEBUG(0,("ads_get_upn: Failed to find account for %s\n", DEBUG(0,("ads_get_upn: Failed to find account for %s\n",
global_myname())); global_myname()));
@ -2786,7 +2790,7 @@ char* ads_get_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *mach
int count = 0; int count = 0;
char *name = NULL; char *name = NULL;
status = ads_find_machine_acct(ads, (void **)(void *)&res, global_myname()); status = ads_find_machine_acct(ads, &res, global_myname());
if (!ADS_ERR_OK(status)) { if (!ADS_ERR_OK(status)) {
DEBUG(0,("ads_get_dnshostname: Failed to find account for %s\n", DEBUG(0,("ads_get_dnshostname: Failed to find account for %s\n",
global_myname())); global_myname()));

View File

@ -27,8 +27,9 @@
Note that results "res" may be allocated on return so that the Note that results "res" may be allocated on return so that the
results can be used. It should be freed using ads_msgfree. results can be used. It should be freed using ads_msgfree.
*/ */
ADS_STATUS ads_find_printer_on_server(ADS_STRUCT *ads, void **res, ADS_STATUS ads_find_printer_on_server(ADS_STRUCT *ads, LDAPMessage **res,
const char *printer, const char *servername) const char *printer,
const char *servername)
{ {
ADS_STATUS status; ADS_STATUS status;
char *srv_dn, **srv_cn, *s; char *srv_dn, **srv_cn, *s;
@ -53,7 +54,7 @@ ADS_STATUS ads_find_printer_on_server(ADS_STRUCT *ads, void **res,
return status; return status;
} }
ADS_STATUS ads_find_printers(ADS_STRUCT *ads, void **res) ADS_STATUS ads_find_printers(ADS_STRUCT *ads, LDAPMessage **res)
{ {
const char *ldap_expr; const char *ldap_expr;
const char *attrs[] = { "objectClass", "printerName", "location", "driverName", const char *attrs[] = { "objectClass", "printerName", "location", "driverName",

View File

@ -29,7 +29,7 @@ ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
char ***OIDs_out, char ***names, size_t *count) char ***OIDs_out, char ***names, size_t *count)
{ {
ADS_STATUS status; ADS_STATUS status;
void *res = NULL; LDAPMessage *res = NULL;
LDAPMessage *msg; LDAPMessage *msg;
char *expr = NULL; char *expr = NULL;
const char *attrs[] = { "lDAPDisplayName", "attributeId", NULL }; const char *attrs[] = { "lDAPDisplayName", "attributeId", NULL };
@ -111,7 +111,7 @@ const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, const char *schema_path, TA
{ {
ADS_STATUS rc; ADS_STATUS rc;
int count = 0; int count = 0;
void *res = NULL; LDAPMessage *res = NULL;
char *expr = NULL; char *expr = NULL;
const char *attrs[] = { "lDAPDisplayName", NULL }; const char *attrs[] = { "lDAPDisplayName", NULL };
char *result; char *result;
@ -155,7 +155,7 @@ failed:
static ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **schema_path) static ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **schema_path)
{ {
ADS_STATUS status; ADS_STATUS status;
void *res; LDAPMessage *res;
const char *schema; const char *schema;
const char *attrs[] = { "schemaNamingContext", NULL }; const char *attrs[] = { "schemaNamingContext", NULL };

View File

@ -25,7 +25,8 @@
/* /*
find a user account find a user account
*/ */
ADS_STATUS ads_find_user_acct(ADS_STRUCT *ads, void **res, const char *user) ADS_STATUS ads_find_user_acct(ADS_STRUCT *ads, LDAPMessage **res,
const char *user)
{ {
ADS_STATUS status; ADS_STATUS status;
char *ldap_exp; char *ldap_exp;

View File

@ -29,7 +29,8 @@
*/ */
static ADS_STATUS ads_do_search_retry_internal(ADS_STRUCT *ads, const char *bind_path, int scope, static ADS_STATUS ads_do_search_retry_internal(ADS_STRUCT *ads, const char *bind_path, int scope,
const char *expr, const char *expr,
const char **attrs, void *args, void **res) const char **attrs, void *args,
LDAPMessage **res)
{ {
ADS_STATUS status = ADS_SUCCESS; ADS_STATUS status = ADS_SUCCESS;
int count = 3; int count = 3;
@ -99,41 +100,41 @@ static ADS_STATUS ads_do_search_retry_internal(ADS_STRUCT *ads, const char *bind
return status; return status;
} }
ADS_STATUS ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path, int scope, ADS_STATUS ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path,
const char *expr, int scope, const char *expr,
const char **attrs, void **res) const char **attrs, LDAPMessage **res)
{ {
return ads_do_search_retry_internal(ads, bind_path, scope, expr, attrs, NULL, res); return ads_do_search_retry_internal(ads, bind_path, scope, expr, attrs, NULL, res);
} }
ADS_STATUS ads_do_search_retry_args(ADS_STRUCT *ads, const char *bind_path, int scope, ADS_STATUS ads_do_search_retry_args(ADS_STRUCT *ads, const char *bind_path,
const char *expr, int scope, const char *expr,
const char **attrs, void *args, void **res) const char **attrs, void *args,
LDAPMessage **res)
{ {
return ads_do_search_retry_internal(ads, bind_path, scope, expr, attrs, args, res); return ads_do_search_retry_internal(ads, bind_path, scope, expr, attrs, args, res);
} }
ADS_STATUS ads_search_retry(ADS_STRUCT *ads, void **res, ADS_STATUS ads_search_retry(ADS_STRUCT *ads, LDAPMessage **res,
const char *expr, const char *expr, const char **attrs)
const char **attrs)
{ {
return ads_do_search_retry(ads, ads->config.bind_path, LDAP_SCOPE_SUBTREE, return ads_do_search_retry(ads, ads->config.bind_path, LDAP_SCOPE_SUBTREE,
expr, attrs, res); expr, attrs, res);
} }
ADS_STATUS ads_search_retry_dn(ADS_STRUCT *ads, void **res, ADS_STATUS ads_search_retry_dn(ADS_STRUCT *ads, LDAPMessage **res,
const char *dn, const char *dn,
const char **attrs) const char **attrs)
{ {
return ads_do_search_retry(ads, dn, LDAP_SCOPE_BASE, return ads_do_search_retry(ads, dn, LDAP_SCOPE_BASE,
"(objectclass=*)", attrs, res); "(objectclass=*)", attrs, res);
} }
ADS_STATUS ads_search_retry_extended_dn(ADS_STRUCT *ads, void **res, ADS_STATUS ads_search_retry_extended_dn(ADS_STRUCT *ads, LDAPMessage **res,
const char *dn, const char *dn,
const char **attrs, const char **attrs,
enum ads_extended_dn_flags flags) enum ads_extended_dn_flags flags)
{ {
ads_control args; ads_control args;
@ -145,9 +146,9 @@ ADS_STATUS ads_search_retry_extended_dn(ADS_STRUCT *ads, void **res,
"(objectclass=*)", attrs, &args, res); "(objectclass=*)", attrs, &args, res);
} }
ADS_STATUS ads_search_retry_sid(ADS_STRUCT *ads, void **res, ADS_STATUS ads_search_retry_sid(ADS_STRUCT *ads, LDAPMessage **res,
const DOM_SID *sid, const DOM_SID *sid,
const char **attrs) const char **attrs)
{ {
char *dn, *sid_string; char *dn, *sid_string;
ADS_STATUS status; ADS_STATUS status;

View File

@ -453,7 +453,7 @@ ADS_STATUS ads_sasl_bind(ADS_STRUCT *ads)
char **values; char **values;
ADS_STATUS status; ADS_STATUS status;
int i, j; int i, j;
void *res; LDAPMessage *res;
/* get a list of supported SASL mechanisms */ /* get a list of supported SASL mechanisms */
status = ads_do_search(ads, "", LDAP_SCOPE_BASE, "(objectclass=*)", attrs, &res); status = ads_do_search(ads, "", LDAP_SCOPE_BASE, "(objectclass=*)", attrs, &res);

View File

@ -171,8 +171,8 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
NULL}; NULL};
int i, count; int i, count;
ADS_STATUS rc; ADS_STATUS rc;
void *res = NULL; LDAPMessage *res = NULL;
void *msg = NULL; LDAPMessage *msg = NULL;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL; NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
*num_entries = 0; *num_entries = 0;
@ -279,8 +279,8 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
"name", "objectSid", NULL}; "name", "objectSid", NULL};
int i, count; int i, count;
ADS_STATUS rc; ADS_STATUS rc;
void *res = NULL; LDAPMessage *res = NULL;
void *msg = NULL; LDAPMessage *msg = NULL;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL; NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
const char *filter; const char *filter;
BOOL enum_dom_local_groups = False; BOOL enum_dom_local_groups = False;
@ -413,7 +413,7 @@ static BOOL dn_lookup(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
const char *dn, const char *dn,
char **name, uint32 *name_type, DOM_SID *sid) char **name, uint32 *name_type, DOM_SID *sid)
{ {
void *res = NULL; LDAPMessage *res = NULL;
const char *attrs[] = {"userPrincipalName", "sAMAccountName", const char *attrs[] = {"userPrincipalName", "sAMAccountName",
"objectSid", "sAMAccountType", NULL}; "objectSid", "sAMAccountType", NULL};
ADS_STATUS rc; ADS_STATUS rc;
@ -469,7 +469,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
NULL}; NULL};
ADS_STATUS rc; ADS_STATUS rc;
int count; int count;
void *msg = NULL; LDAPMessage *msg = NULL;
char *ldap_exp; char *ldap_exp;
char *sidstr; char *sidstr;
uint32 group_rid; uint32 group_rid;
@ -551,8 +551,8 @@ static NTSTATUS lookup_usergroups_member(struct winbindd_domain *domain,
ADS_STATUS rc; ADS_STATUS rc;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL; NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
int count; int count;
void *res = NULL; LDAPMessage *res = NULL;
void *msg = NULL; LDAPMessage *msg = NULL;
char *ldap_exp; char *ldap_exp;
ADS_STRUCT *ads; ADS_STRUCT *ads;
const char *group_attrs[] = {"objectSid", NULL}; const char *group_attrs[] = {"objectSid", NULL};
@ -640,7 +640,7 @@ static NTSTATUS lookup_usergroups_memberof(struct winbindd_domain *domain,
ADS_STATUS rc; ADS_STATUS rc;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL; NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
int count; int count;
void *res = NULL; LDAPMessage *res = NULL;
ADS_STRUCT *ads; ADS_STRUCT *ads;
const char *attrs[] = {"memberOf", NULL}; const char *attrs[] = {"memberOf", NULL};
size_t num_groups = 0; size_t num_groups = 0;
@ -749,7 +749,7 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
goto done; goto done;
} }
rc = ads_search_retry_sid(ads, (void**)(void *)&msg, sid, attrs); rc = ads_search_retry_sid(ads, &msg, sid, attrs);
if (!ADS_ERR_OK(rc)) { if (!ADS_ERR_OK(rc)) {
status = ads_ntstatus(rc); status = ads_ntstatus(rc);
@ -860,7 +860,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
{ {
ADS_STATUS rc; ADS_STATUS rc;
int count; int count;
void *res=NULL; LDAPMessage *res=NULL;
ADS_STRUCT *ads = NULL; ADS_STRUCT *ads = NULL;
char *ldap_exp; char *ldap_exp;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL; NTSTATUS status = NT_STATUS_UNSUCCESSFUL;

View File

@ -3022,7 +3022,7 @@ static WERROR nt_printer_publish_ads(ADS_STRUCT *ads,
NT_PRINTER_INFO_LEVEL *printer) NT_PRINTER_INFO_LEVEL *printer)
{ {
ADS_STATUS ads_rc; ADS_STATUS ads_rc;
void *res; LDAPMessage *res;
char *prt_dn = NULL, *srv_dn, *srv_cn_0; char *prt_dn = NULL, *srv_dn, *srv_cn_0;
char *srv_dn_utf8, **srv_cn_utf8; char *srv_dn_utf8, **srv_cn_utf8;
TALLOC_CTX *ctx; TALLOC_CTX *ctx;
@ -3121,7 +3121,7 @@ static WERROR nt_printer_unpublish_ads(ADS_STRUCT *ads,
NT_PRINTER_INFO_LEVEL *printer) NT_PRINTER_INFO_LEVEL *printer)
{ {
ADS_STATUS ads_rc; ADS_STATUS ads_rc;
void *res; LDAPMessage *res;
char *prt_dn = NULL; char *prt_dn = NULL;
DEBUG(5, ("unpublishing printer %s\n", printer->info_2->printername)); DEBUG(5, ("unpublishing printer %s\n", printer->info_2->printername));

View File

@ -399,7 +399,7 @@ static int ads_user_add(int argc, const char **argv)
ADS_STRUCT *ads; ADS_STRUCT *ads;
ADS_STATUS status; ADS_STATUS status;
char *upn, *userdn; char *upn, *userdn;
void *res=NULL; LDAPMessage *res=NULL;
int rc = -1; int rc = -1;
if (argc < 1) return net_ads_user_usage(argc, argv); if (argc < 1) return net_ads_user_usage(argc, argv);
@ -472,7 +472,7 @@ static int ads_user_info(int argc, const char **argv)
{ {
ADS_STRUCT *ads; ADS_STRUCT *ads;
ADS_STATUS rc; ADS_STATUS rc;
void *res; LDAPMessage *res;
const char *attrs[] = {"memberOf", NULL}; const char *attrs[] = {"memberOf", NULL};
char *searchstring=NULL; char *searchstring=NULL;
char **grouplist; char **grouplist;
@ -529,7 +529,7 @@ static int ads_user_delete(int argc, const char **argv)
{ {
ADS_STRUCT *ads; ADS_STRUCT *ads;
ADS_STATUS rc; ADS_STATUS rc;
void *res; LDAPMessage *res;
char *userdn; char *userdn;
if (argc < 1) { if (argc < 1) {
@ -606,7 +606,7 @@ static int ads_group_add(int argc, const char **argv)
{ {
ADS_STRUCT *ads; ADS_STRUCT *ads;
ADS_STATUS status; ADS_STATUS status;
void *res=NULL; LDAPMessage *res=NULL;
int rc = -1; int rc = -1;
if (argc < 1) { if (argc < 1) {
@ -655,7 +655,7 @@ static int ads_group_delete(int argc, const char **argv)
{ {
ADS_STRUCT *ads; ADS_STRUCT *ads;
ADS_STATUS rc; ADS_STATUS rc;
void *res; LDAPMessage *res;
char *groupdn; char *groupdn;
if (argc < 1) { if (argc < 1) {
@ -725,7 +725,7 @@ static int net_ads_status(int argc, const char **argv)
{ {
ADS_STRUCT *ads; ADS_STRUCT *ads;
ADS_STATUS rc; ADS_STATUS rc;
void *res; LDAPMessage *res;
if (!ADS_ERR_OK(ads_startup(True, &ads))) { if (!ADS_ERR_OK(ads_startup(True, &ads))) {
return -1; return -1;
@ -944,7 +944,7 @@ static ADS_STATUS net_set_machine_spn(TALLOC_CTX *ctx, ADS_STRUCT *ads_s )
/* Find our DN */ /* Find our DN */
status = ads_find_machine_acct(ads_s, (void **)(void *)&res, machine_name); status = ads_find_machine_acct(ads_s, &res, machine_name);
if (!ADS_ERR_OK(status)) if (!ADS_ERR_OK(status))
return status; return status;
@ -1014,7 +1014,7 @@ static ADS_STATUS net_set_machine_upn(TALLOC_CTX *ctx, ADS_STRUCT *ads_s, const
/* Find our DN */ /* Find our DN */
status = ads_find_machine_acct(ads_s, (void **)(void *)&res, machine_name); status = ads_find_machine_acct(ads_s, &res, machine_name);
if (!ADS_ERR_OK(status)) if (!ADS_ERR_OK(status))
return status; return status;
@ -1118,7 +1118,7 @@ static BOOL net_derive_salting_principal( TALLOC_CTX *ctx, ADS_STRUCT *ads )
char *upn; char *upn;
int count; int count;
status = ads_find_machine_acct(ads, (void **)(void *)&res, machine_name); status = ads_find_machine_acct(ads, &res, machine_name);
if (!ADS_ERR_OK(status)) { if (!ADS_ERR_OK(status)) {
return False; return False;
} }
@ -1566,7 +1566,7 @@ static int net_ads_printer_search(int argc, const char **argv)
{ {
ADS_STRUCT *ads; ADS_STRUCT *ads;
ADS_STATUS rc; ADS_STATUS rc;
void *res = NULL; LDAPMessage *res = NULL;
if (!ADS_ERR_OK(ads_startup(False, &ads))) { if (!ADS_ERR_OK(ads_startup(False, &ads))) {
return -1; return -1;
@ -1599,7 +1599,7 @@ static int net_ads_printer_info(int argc, const char **argv)
ADS_STRUCT *ads; ADS_STRUCT *ads;
ADS_STATUS rc; ADS_STATUS rc;
const char *servername, *printername; const char *servername, *printername;
void *res = NULL; LDAPMessage *res = NULL;
if (!ADS_ERR_OK(ads_startup(False, &ads))) { if (!ADS_ERR_OK(ads_startup(False, &ads))) {
return -1; return -1;
@ -1658,7 +1658,7 @@ static int net_ads_printer_publish(int argc, const char **argv)
TALLOC_CTX *mem_ctx = talloc_init("net_ads_printer_publish"); TALLOC_CTX *mem_ctx = talloc_init("net_ads_printer_publish");
ADS_MODLIST mods = ads_init_mods(mem_ctx); ADS_MODLIST mods = ads_init_mods(mem_ctx);
char *prt_dn, *srv_dn, **srv_cn; char *prt_dn, *srv_dn, **srv_cn;
void *res = NULL; LDAPMessage *res = NULL;
if (!ADS_ERR_OK(ads_startup(True, &ads))) { if (!ADS_ERR_OK(ads_startup(True, &ads))) {
return -1; return -1;
@ -1741,7 +1741,7 @@ static int net_ads_printer_remove(int argc, const char **argv)
ADS_STATUS rc; ADS_STATUS rc;
const char *servername; const char *servername;
char *prt_dn; char *prt_dn;
void *res = NULL; LDAPMessage *res = NULL;
if (!ADS_ERR_OK(ads_startup(True, &ads))) { if (!ADS_ERR_OK(ads_startup(True, &ads))) {
return -1; return -1;
@ -1949,7 +1949,7 @@ static int net_ads_search(int argc, const char **argv)
ADS_STATUS rc; ADS_STATUS rc;
const char *ldap_exp; const char *ldap_exp;
const char **attrs; const char **attrs;
void *res = NULL; LDAPMessage *res = NULL;
if (argc < 1) { if (argc < 1) {
return net_ads_search_usage(argc, argv); return net_ads_search_usage(argc, argv);
@ -2009,7 +2009,7 @@ static int net_ads_dn(int argc, const char **argv)
ADS_STATUS rc; ADS_STATUS rc;
const char *dn; const char *dn;
const char **attrs; const char **attrs;
void *res = NULL; LDAPMessage *res = NULL;
if (argc < 1) { if (argc < 1) {
return net_ads_dn_usage(argc, argv); return net_ads_dn_usage(argc, argv);
@ -2068,7 +2068,7 @@ static int net_ads_sid(int argc, const char **argv)
ADS_STATUS rc; ADS_STATUS rc;
const char *sid_string; const char *sid_string;
const char **attrs; const char **attrs;
void *res = NULL; LDAPMessage *res = NULL;
DOM_SID sid; DOM_SID sid;
if (argc < 1) { if (argc < 1) {

View File

@ -30,7 +30,7 @@
/********************************************************************* /*********************************************************************
*********************************************************************/ *********************************************************************/
int DoDNSUpdate( char *pszServerName, char *pszDomainName, int DoDNSUpdate( char *pszServerName, const char *pszDomainName,
char *pszHostName, struct in_addr *iplist, int num_addrs ) char *pszHostName, struct in_addr *iplist, int num_addrs )
{ {
int32 dwError = 0; int32 dwError = 0;