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

r5428: Apply some const. LDAP attribs should now be declared const char *attr[]. This

gives some new warnings in smbldap.c, but a the callers are cleaned up.

Volker
This commit is contained in:
Volker Lendecke 2005-02-17 14:27:34 +00:00 committed by Gerald (Jerry) Carter
parent a7df3b5f06
commit 543799fc0d
5 changed files with 38 additions and 37 deletions

View File

@ -120,8 +120,8 @@ extern ATTRIB_MAP_ENTRY sidmap_attr_list[];
have to worry about LDAP structure types */
const char* get_attr_key2string( ATTRIB_MAP_ENTRY table[], int key );
char** get_attr_list( ATTRIB_MAP_ENTRY table[] );
void free_attr_list( char **list );
const char** get_attr_list( ATTRIB_MAP_ENTRY table[] );
void free_attr_list( const char **list );
void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value);
void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
LDAPMod ***mods,

View File

@ -230,16 +230,16 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
Return the list of attribute names from a mapping table
**********************************************************************/
char** get_attr_list( ATTRIB_MAP_ENTRY table[] )
const char** get_attr_list( ATTRIB_MAP_ENTRY table[] )
{
char **names;
const char **names;
int i = 0;
while ( table[i].attrib != LDAP_ATTR_LIST_END )
i++;
i++;
names = SMB_MALLOC_ARRAY( char*, i );
names = SMB_MALLOC_ARRAY( const char*, i );
if ( !names ) {
DEBUG(0,("get_attr_list: out of memory\n"));
return NULL;
@ -259,7 +259,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
Cleanup
********************************************************************/
void free_attr_list( char **list )
void free_attr_list( const char **list )
{
int i = 0;
@ -1017,7 +1017,7 @@ static int another_ldap_try(struct smbldap_state *ldap_state, int *rc,
int smbldap_search(struct smbldap_state *ldap_state,
const char *base, int scope, const char *filter,
char *attrs[], int attrsonly,
const char *attrs[], int attrsonly,
LDAPMessage **res)
{
int rc = LDAP_SERVER_DOWN;
@ -1154,7 +1154,7 @@ int smbldap_extended_operation(struct smbldap_state *ldap_state,
run the search by name.
******************************************************************/
int smbldap_search_suffix (struct smbldap_state *ldap_state, const char *filter,
char **search_attr, LDAPMessage ** result)
const char **search_attr, LDAPMessage ** result)
{
int scope = LDAP_SCOPE_SUBTREE;
int rc;
@ -1261,7 +1261,7 @@ static NTSTATUS add_new_domain_info(struct smbldap_state *ldap_state,
int ldap_op;
LDAPMessage *result = NULL;
int num_result;
char **attr_list;
const char **attr_list;
uid_t u_low, u_high;
gid_t g_low, g_high;
uint32 rid_low, rid_high;
@ -1376,7 +1376,7 @@ NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
pstring filter;
int rc;
char **attr_list;
const char **attr_list;
int count;
pstr_sprintf(filter, "(&(objectClass=%s)(%s=%s))",

View File

@ -769,7 +769,7 @@ static int get_ldap_seq(const char *server, int port, uint32 *seq)
{
int ret = -1;
struct timeval to;
char *attrs[] = {"highestCommittedUSN", NULL};
const char *attrs[] = {"highestCommittedUSN", NULL};
LDAPMessage *res = NULL;
char **values = NULL;
LDAP *ldp = NULL;

View File

@ -134,7 +134,7 @@ static const char* get_userattr_key2string( int schema_ver, int key )
Return the list of attribute names given a user schema version.
**********************************************************************/
static char** get_userattr_list( int schema_ver )
static const char** get_userattr_list( int schema_ver )
{
switch ( schema_ver ) {
case SCHEMAVER_SAMBAACCOUNT:
@ -154,7 +154,7 @@ static char** get_userattr_list( int schema_ver )
Return the list of attribute names to delete given a user schema version.
**************************************************************************/
static char** get_userattr_delete_list( int schema_ver )
static const char** get_userattr_delete_list( int schema_ver )
{
switch ( schema_ver ) {
case SCHEMAVER_SAMBAACCOUNT:
@ -201,7 +201,8 @@ static const char* get_objclass_filter( int schema_ver )
static int ldapsam_search_suffix_by_name (struct ldapsam_privates *ldap_state,
const char *user,
LDAPMessage ** result, char **attr)
LDAPMessage ** result,
const char **attr)
{
pstring filter;
char *escape_user = escape_ldap_string_alloc(user);
@ -235,7 +236,7 @@ static int ldapsam_search_suffix_by_name (struct ldapsam_privates *ldap_state,
static int ldapsam_search_suffix_by_rid (struct ldapsam_privates *ldap_state,
uint32 rid, LDAPMessage ** result,
char **attr)
const char **attr)
{
pstring filter;
int rc;
@ -254,7 +255,7 @@ static int ldapsam_search_suffix_by_rid (struct ldapsam_privates *ldap_state,
static int ldapsam_search_suffix_by_sid (struct ldapsam_privates *ldap_state,
const DOM_SID *sid, LDAPMessage ** result,
char **attr)
const char **attr)
{
pstring filter;
int rc;
@ -278,7 +279,7 @@ static int ldapsam_search_suffix_by_sid (struct ldapsam_privates *ldap_state,
static NTSTATUS ldapsam_delete_entry(struct ldapsam_privates *ldap_state,
LDAPMessage *result,
const char *objectclass,
char **attrs)
const char **attrs)
{
int rc;
LDAPMessage *entry = NULL;
@ -316,7 +317,7 @@ static NTSTATUS ldapsam_delete_entry(struct ldapsam_privates *ldap_state,
for (name = ldap_first_attribute(ldap_state->smbldap_state->ldap_struct, entry, &ptr);
name != NULL;
name = ldap_next_attribute(ldap_state->smbldap_state->ldap_struct, entry, ptr)) {
char **attrib;
const char **attrib;
/* We are only allowed to delete the attributes that
really exist. */
@ -1192,7 +1193,7 @@ static NTSTATUS ldapsam_setsampwent(struct pdb_methods *my_methods, BOOL update,
struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
int rc;
pstring filter, suffix;
char **attr_list;
const char **attr_list;
BOOL machine_mask = False, user_mask = False;
pstr_sprintf( filter, "(&%s%s)", lp_ldap_filter(),
@ -1274,7 +1275,7 @@ static NTSTATUS ldapsam_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUNT
return NT_STATUS_OK;
}
static void append_attr(char ***attr_list, const char *new_attr)
static void append_attr(const char ***attr_list, const char *new_attr)
{
int i;
@ -1286,7 +1287,7 @@ static void append_attr(char ***attr_list, const char *new_attr)
;
}
(*attr_list) = SMB_REALLOC_ARRAY((*attr_list), char *, i+2);
(*attr_list) = SMB_REALLOC_ARRAY((*attr_list), const char *, i+2);
SMB_ASSERT((*attr_list) != NULL);
(*attr_list)[i] = SMB_STRDUP(new_attr);
(*attr_list)[i+1] = NULL;
@ -1303,7 +1304,7 @@ static NTSTATUS ldapsam_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT
LDAPMessage *result = NULL;
LDAPMessage *entry = NULL;
int count;
char ** attr_list;
const char ** attr_list;
int rc;
attr_list = get_userattr_list( ldap_state->schema_ver );
@ -1347,7 +1348,7 @@ static int ldapsam_get_ldap_user_by_sid(struct ldapsam_privates *ldap_state,
const DOM_SID *sid, LDAPMessage **result)
{
int rc = -1;
char ** attr_list;
const char ** attr_list;
uint32 rid;
switch ( ldap_state->schema_ver ) {
@ -1577,7 +1578,7 @@ static NTSTATUS ldapsam_delete_sam_account(struct pdb_methods *my_methods, SAM_A
int rc;
LDAPMessage *result = NULL;
NTSTATUS ret;
char **attr_list;
const char **attr_list;
fstring objclass;
if (!sam_acct) {
@ -1642,7 +1643,7 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, SAM_A
LDAPMessage *result = NULL;
LDAPMessage *entry = NULL;
LDAPMod **mods = NULL;
char **attr_list;
const char **attr_list;
result = pdb_get_backend_private_data(newpwd, my_methods);
if (!result) {
@ -1730,7 +1731,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO
LDAPMod **mods = NULL;
int ldap_op = LDAP_MOD_REPLACE;
uint32 num_result;
char **attr_list;
const char **attr_list;
char *escape_user;
const char *username = pdb_get_username(newpwd);
const DOM_SID *sid = pdb_get_user_sid(newpwd);
@ -1930,7 +1931,7 @@ static int ldapsam_search_one_group (struct ldapsam_privates *ldap_state,
{
int scope = LDAP_SCOPE_SUBTREE;
int rc;
char **attr_list;
const char **attr_list;
attr_list = get_attr_list(groupmap_attr_list);
rc = smbldap_search(ldap_state->smbldap_state,
@ -2174,7 +2175,7 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
(struct ldapsam_privates *)methods->private_data;
struct smbldap_state *conn = ldap_state->smbldap_state;
pstring filter;
char *attrs[] = { "gidNumber", "sambaSID", NULL };
const char *attrs[] = { "gidNumber", "sambaSID", NULL };
char *escape_name;
int rc;
LDAPMessage *msg = NULL;
@ -2330,7 +2331,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
pstring suffix;
pstring filter;
char **attr_list;
const char **attr_list;
ldap_msgfree(result);
@ -2489,7 +2490,7 @@ static NTSTATUS ldapsam_delete_group_mapping_entry(struct pdb_methods *methods,
LDAPMessage *result = NULL;
int rc;
NTSTATUS ret;
char **attr_list;
const char **attr_list;
sid_to_string(sidstring, &sid);
@ -2519,7 +2520,7 @@ static NTSTATUS ldapsam_setsamgrent(struct pdb_methods *my_methods, BOOL update)
struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
fstring filter;
int rc;
char **attr_list;
const char **attr_list;
pstr_sprintf( filter, "(objectclass=%s)", LDAP_OBJ_GROUPMAP);
attr_list = get_attr_list( groupmap_attr_list );
@ -2815,7 +2816,7 @@ static NTSTATUS ldapsam_alias_memberships(struct pdb_methods *methods,
(struct ldapsam_privates *)methods->private_data;
LDAP *ldap_struct;
char *attrs[] = { LDAP_ATTRIBUTE_SID, NULL };
const char *attrs[] = { LDAP_ATTRIBUTE_SID, NULL };
LDAPMessage *result = NULL;
LDAPMessage *entry = NULL;

View File

@ -125,7 +125,7 @@ static BOOL sid_in_use(struct ldap_idmap_state *state,
fstring sid_string;
LDAPMessage *result = NULL;
int rc;
char *sid_attr[] = {LDAP_ATTRIBUTE_SID, NULL};
const char *sid_attr[] = {LDAP_ATTRIBUTE_SID, NULL};
slprintf(filter, sizeof(filter)-1, "(%s=%s)", LDAP_ATTRIBUTE_SID, sid_to_string(sid_string, sid));
@ -382,7 +382,7 @@ static NTSTATUS ldap_allocate_id(unid_t *id, int id_type)
LDAPMod **mods = NULL;
const char *type;
char *dn = NULL;
char **attr_list;
const char **attr_list;
pstring filter;
uid_t luid, huid;
gid_t lgid, hgid;
@ -493,7 +493,7 @@ static NTSTATUS ldap_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type)
int rc;
int count;
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
char **attr_list;
const char **attr_list;
if ( id_type & ID_USERID )
type = get_attr_key2string( idpool_attr_list, LDAP_ATTR_UIDNUMBER );
@ -557,7 +557,7 @@ static NTSTATUS ldap_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *si
const char *type;
int rc;
int count;
char **attr_list;
const char **attr_list;
char *dn = NULL;
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
@ -667,7 +667,7 @@ static NTSTATUS verify_idpool( void )
{
fstring filter;
int rc;
char **attr_list;
const char **attr_list;
LDAPMessage *result = NULL;
LDAPMod **mods = NULL;
int count;