diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2010-10-15 10:21:35 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2010-10-15 10:21:35 +0000 |
commit | e6100f8a81d178f1307571a5773931dd976986c2 (patch) | |
tree | 8a0a6e43f8539bc9de93c8f127452d46db24627b /common | |
parent | 3128e988fa37671c3ca8b81f235d3e4a505aa256 (diff) |
make DICTs and SETs case-sensitive
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1278 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'common')
-rw-r--r-- | common/dict.c | 11 | ||||
-rw-r--r-- | common/dict.h | 11 | ||||
-rw-r--r-- | common/set.h | 8 |
3 files changed, 14 insertions, 16 deletions
diff --git a/common/dict.c b/common/dict.c index 128321d..a5068e9 100644 --- a/common/dict.c +++ b/common/dict.c @@ -2,7 +2,7 @@ dict.c - dictionary functions This file is part of the nss-pam-ldapd library. - Copyright (C) 2007, 2008, 2009 Arthur de Jong + Copyright (C) 2007, 2008, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -69,13 +69,12 @@ struct dictionary { struct dict_entry **table; /* the hashtable */ }; -/* Simple hash function that computes the hash value of a lower-cased - string. */ +/* Simple hash function that computes the hash value of a string. */ static uint32_t stringhash(const char *str) { uint32_t hash=0; while (*str!='\0') - hash=3*hash+tolower(*str++); + hash=3*hash+*str++; return hash; } @@ -170,7 +169,7 @@ void *dict_get(DICT *dict,const char *key) for (entry=dict->table[hash%dict->size];entry!=NULL;entry=entry->next) { if ( (entry->hash==hash) && - (strcasecmp(entry->key,key)==0) ) + (strcmp(entry->key,key)==0) ) return entry->value; } /* no matches found */ @@ -196,7 +195,7 @@ int dict_put(DICT *dict,const char *key,void *value) prev=entry,entry=entry->next) { if ( (entry->hash==hash) && - (strcasecmp(entry->key,key)==0) ) + (strcmp(entry->key,key)==0) ) { /* check if we should unset the entry */ if (value==NULL) diff --git a/common/dict.h b/common/dict.h index ee231e1..c4f94ae 100644 --- a/common/dict.h +++ b/common/dict.h @@ -2,7 +2,7 @@ dict.h - dictionary functions This file is part of the nss-pam-ldapd library. - Copyright (C) 2007, 2008, 2009 Arthur de Jong + Copyright (C) 2007, 2008, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -26,8 +26,7 @@ #include "compat/attrs.h" /* - These functions provide a mapping between a case insensitive - string and a pointer. + These functions provide a mapping between a string and a pointer. */ typedef struct dictionary DICT; @@ -40,17 +39,17 @@ DICT *dict_new(void) and can be reused by the caller. The pointer is just stored. This function returns non-0 in case of memory allocation errors. If the key was previously in use the value - is replaced. All key comparisons are case insensitive. */ + is replaced. All key comparisons are case sensitive. */ int dict_put(DICT *dict,const char *key,void *value); /* Look up a key in the dictionary and return the associated value. NULL is returned if the key is not found in the dictionary. - All key comparisons are case insensitive. */ + All key comparisons are case sensitive. */ void *dict_get(DICT *dict,const char *key) MUST_USE; /* Delete a key-value association from the dictionary. - All key comparisons are case insensitive. */ + All key comparisons are case sensitive. */ /*void dict_del(DICT *dict,const char *key);*/ /* Remove the dictionary from memory. All allocated storage diff --git a/common/set.h b/common/set.h index 5824bfc..ce5c843 100644 --- a/common/set.h +++ b/common/set.h @@ -2,7 +2,7 @@ set.h - set functions This file is part of the nss-pam-ldapd library. - Copyright (C) 2008, 2009 Arthur de Jong + Copyright (C) 2008, 2009, 2010 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -26,7 +26,7 @@ #include "compat/attrs.h" /* - These functions provide a set of string in an unordered + These functions provide a set of strings in an unordered collection. */ typedef struct set SET; @@ -39,11 +39,11 @@ SET *set_new(void) /* Add a string in the set. The value is duplicated and can be reused by the caller. This function returns non-0 in case of memory allocation - errors. All value comparisons are case insensitive. */ + errors. All value comparisons are case sensitive. */ int set_add(SET *set,const char *value); /* Return non-zero if the value is in the set. - All value comparisons are case insensitive. */ + All value comparisons are case sensitive. */ int set_contains(SET *set,const char *value) MUST_USE; |