mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s3-winbindd: Move idmap_fetch_secret to idmap_utils.c for reuse
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
86d09ce779
commit
c07c167edb
@ -39,30 +39,6 @@
|
||||
#include "smbldap.h"
|
||||
#include "passdb/pdb_ldap_schema.h"
|
||||
|
||||
static char *idmap_fetch_secret(const char *backend,
|
||||
const char *domain, const char *identity)
|
||||
{
|
||||
char *tmp, *ret;
|
||||
int r;
|
||||
|
||||
r = asprintf(&tmp, "IDMAP_%s_%s", backend, domain);
|
||||
|
||||
if (r < 0)
|
||||
return NULL;
|
||||
|
||||
/* make sure the key is case insensitive */
|
||||
if (!strupper_m(tmp)) {
|
||||
SAFE_FREE(tmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = secrets_fetch_generic(tmp, identity);
|
||||
|
||||
SAFE_FREE(tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct idmap_ldap_context {
|
||||
struct smbldap_state *smbldap_state;
|
||||
char *url;
|
||||
|
@ -57,6 +57,8 @@ bool idmap_unix_id_is_in_range(uint32_t id, struct idmap_domain *dom);
|
||||
struct id_map *idmap_find_map_by_id(struct id_map **maps, enum id_type type,
|
||||
uint32_t id);
|
||||
struct id_map *idmap_find_map_by_sid(struct id_map **maps, struct dom_sid *sid);
|
||||
char *idmap_fetch_secret(const char *backend, const char *domain,
|
||||
const char *identity);
|
||||
|
||||
/* max number of ids requested per LDAP batch query */
|
||||
#define IDMAP_LDAP_MAX_IDS 30
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "idmap.h"
|
||||
#include "idmap_cache.h"
|
||||
#include "../libcli/security/security.h"
|
||||
#include "secrets.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_IDMAP
|
||||
@ -213,3 +214,27 @@ struct id_map *idmap_find_map_by_sid(struct id_map **maps, struct dom_sid *sid)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *idmap_fetch_secret(const char *backend, const char *domain,
|
||||
const char *identity)
|
||||
{
|
||||
char *tmp, *ret;
|
||||
int r;
|
||||
|
||||
r = asprintf(&tmp, "IDMAP_%s_%s", backend, domain);
|
||||
|
||||
if (r < 0)
|
||||
return NULL;
|
||||
|
||||
/* make sure the key is case insensitive */
|
||||
if (!strupper_m(tmp)) {
|
||||
SAFE_FREE(tmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = secrets_fetch_generic(tmp, identity);
|
||||
|
||||
SAFE_FREE(tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user