diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-03-27 10:59:03 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:18:56 -0500 |
commit | 5060393272b2053b34d482a3c19e58a710a29d42 (patch) | |
tree | 0665a09c8c8ebbfbbc33e5f1bb1124fb24521fa2 /source3/nsswitch | |
parent | ef0a0f9b2bc46395c16e5d5a86ae357b4fc77646 (diff) | |
download | samba-5060393272b2053b34d482a3c19e58a710a29d42.tar.gz samba-5060393272b2053b34d482a3c19e58a710a29d42.tar.bz2 samba-5060393272b2053b34d482a3c19e58a710a29d42.zip |
r21985: make use of string_tdb_data()
to avoid creating the TDB_DATA struct from strings "by hand"
metze
(This used to be commit a8bc20d67f481a790524cad24e253436227af721)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/winbindd_cache.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c index 4133611148..739ff7bdde 100644 --- a/source3/nsswitch/winbindd_cache.c +++ b/source3/nsswitch/winbindd_cache.c @@ -520,8 +520,7 @@ static struct cache_entry *wcache_fetch_raw(char *kstr) struct cache_entry *centry; TDB_DATA key; - key.dptr = kstr; - key.dsize = strlen(kstr); + key = string_tdb_data(kstr); data = tdb_fetch(wcache->tdb, key); if (!data.dptr) { /* a cache miss */ @@ -605,8 +604,7 @@ static void wcache_delete(const char *format, ...) smb_xvasprintf(&kstr, format, ap); va_end(ap); - key.dptr = kstr; - key.dsize = strlen(kstr); + key = string_tdb_data(kstr); tdb_delete(wcache->tdb, key); free(kstr); @@ -757,8 +755,7 @@ static void centry_end(struct cache_entry *centry, const char *format, ...) smb_xvasprintf(&kstr, format, ap); va_end(ap); - key.dptr = kstr; - key.dsize = strlen(kstr); + key = string_tdb_data(kstr); data.dptr = (char *)centry->data; data.dsize = centry->ofs; @@ -896,7 +893,7 @@ NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const DOM_SID fstr_sprintf(key_str, "CRED/%s", sid_string_static(sid)); - data = tdb_fetch(cache->tdb, make_tdb_data(key_str, strlen(key_str))); + data = tdb_fetch(cache->tdb, string_tdb_data(key_str)); if (!data.dptr) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; } @@ -2486,7 +2483,7 @@ NTSTATUS wcache_remove_oldest_cached_creds(struct winbindd_domain *domain, const TDB_DATA data; time_t t; - data = tdb_fetch(cache->tdb, make_tdb_data(cred->name, strlen(cred->name))); + data = tdb_fetch(cache->tdb, string_tdb_data(cred->name)); if (!data.dptr) { DEBUG(10,("wcache_remove_oldest_cached_creds: entry for [%s] not found\n", cred->name)); |