diff options
author | Jeremy Allison <jra@samba.org> | 2007-04-13 01:46:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:19 -0500 |
commit | a2bab163bead11502f07844c56e273ae3e696a0c (patch) | |
tree | 3b9a142bfad83515684664b339e02f47a670af92 /source3/nsswitch | |
parent | 127cc730342c0adce7c44453c4463de21d244e6c (diff) | |
download | samba-a2bab163bead11502f07844c56e273ae3e696a0c.tar.gz samba-a2bab163bead11502f07844c56e273ae3e696a0c.tar.bz2 samba-a2bab163bead11502f07844c56e273ae3e696a0c.zip |
r22207: Fill in the validation functions. Now to test...
Jeremy.
(This used to be commit fc2b9e860ef9512eb074622e0ad134ff3f30bfe7)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/winbindd_cache.c | 101 |
1 files changed, 73 insertions, 28 deletions
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c index f0e12dfb0d..355f3e1b16 100644 --- a/source3/nsswitch/winbindd_cache.c +++ b/source3/nsswitch/winbindd_cache.c @@ -2757,7 +2757,11 @@ static int validate_pwd_pol(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA db return 1; } - /* FIXME - fill in details here... */ + (void)centry_uint16(centry); + (void)centry_uint16(centry); + (void)centry_uint32(centry); + (void)centry_nttime(centry); + (void)centry_nttime(centry); centry_free(centry); @@ -2776,7 +2780,13 @@ static int validate_cred(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) return 1; } - /* FIXME - fill in details here... */ + (void)centry_time(centry); + (void)centry_hash16(centry, mem_ctx); + + /* We only have 17 bytes more data in the salted cred case. */ + if (centry->len - centry->ofs == 17) { + (void)centry_hash16(centry, mem_ctx); + } centry_free(centry); @@ -2790,12 +2800,23 @@ static int validate_cred(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) static int validate_ul(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) { struct cache_entry *centry = create_centry_validate(keystr, dbuf); + int32 num_entries, i; if (!centry) { return 1; } - /* FIXME - fill in details here... */ + num_entries = (int32)centry_uint32(centry); + + for (i=0; i< num_entries; i++) { + DOM_SID sid; + (void)centry_string(centry, mem_ctx); + (void)centry_string(centry, mem_ctx); + (void)centry_string(centry, mem_ctx); + (void)centry_string(centry, mem_ctx); + (void)centry_sid(centry, mem_ctx, &sid); + (void)centry_sid(centry, mem_ctx, &sid); + } centry_free(centry); @@ -2809,12 +2830,19 @@ static int validate_ul(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) static int validate_gl(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) { struct cache_entry *centry = create_centry_validate(keystr, dbuf); + int32 num_entries, i; if (!centry) { return 1; } - /* FIXME - fill in details here... */ + num_entries = centry_uint32(centry); + + for (i=0; i< num_entries; i++) { + (void)centry_string(centry, mem_ctx); + (void)centry_string(centry, mem_ctx); + (void)centry_uint32(centry); + } centry_free(centry); @@ -2828,12 +2856,18 @@ static int validate_gl(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) static int validate_ug(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) { struct cache_entry *centry = create_centry_validate(keystr, dbuf); + int32 num_groups, i; if (!centry) { return 1; } - /* FIXME - fill in details here... */ + num_groups = centry_uint32(centry); + + for (i=0; i< num_groups; i++) { + DOM_SID sid; + centry_sid(centry, mem_ctx, &sid); + } centry_free(centry); @@ -2847,12 +2881,17 @@ static int validate_ug(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) static int validate_ua(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) { struct cache_entry *centry = create_centry_validate(keystr, dbuf); + int32 num_aliases, i; if (!centry) { return 1; } - /* FIXME - fill in details here... */ + num_aliases = centry_uint32(centry); + + for (i=0; i < num_aliases; i++) { + (void)centry_uint32(centry); + } centry_free(centry); @@ -2866,12 +2905,20 @@ static int validate_ua(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) static int validate_gm(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) { struct cache_entry *centry = create_centry_validate(keystr, dbuf); + int32 num_names, i; if (!centry) { return 1; } - /* FIXME - fill in details here... */ + num_names = centry_uint32(centry); + + for (i=0; i< num_names; i++) { + DOM_SID sid; + centry_sid(centry, mem_ctx, &sid); + (void)centry_string(centry, mem_ctx); + (void)centry_uint32(centry); + } centry_free(centry); @@ -2884,38 +2931,28 @@ static int validate_gm(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) static int validate_dr(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) { - struct cache_entry *centry = create_centry_validate(keystr, dbuf); - - if (!centry) { + /* Can't say anything about this other than must be nonzero. */ + if (dbuf.dsize == 0) { + DEBUG(0,("validate_dr: Corrupt cache for key %s (len == 0) ?\n", + keystr)); + bad_cache_entry = True; return 1; } - /* FIXME - fill in details here... */ - - centry_free(centry); - - if (bad_cache_entry) { - return 1; - } DEBUG(10,("validate_dr: %s ok\n", keystr)); return 0; } static int validate_de(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) { - struct cache_entry *centry = create_centry_validate(keystr, dbuf); - - if (!centry) { + /* Can't say anything about this other than must be nonzero. */ + if (dbuf.dsize == 0) { + DEBUG(0,("validate_de: Corrupt cache for key %s (len == 0) ?\n", + keystr)); + bad_cache_entry = True; return 1; } - /* FIXME - fill in details here... */ - - centry_free(centry); - - if (bad_cache_entry) { - return 1; - } DEBUG(10,("validate_de: %s ok\n", keystr)); return 0; } @@ -2923,12 +2960,20 @@ static int validate_de(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) static int validate_trustdoms(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf) { struct cache_entry *centry = create_centry_validate(keystr, dbuf); + int32 num_domains, i; if (!centry) { return 1; } - /* FIXME - fill in details here... */ + num_domains = centry_uint32(centry); + + for (i=0; i< num_domains; i++) { + DOM_SID sid; + (void)centry_string(centry, mem_ctx); + (void)centry_string(centry, mem_ctx); + (void)centry_sid(centry, mem_ctx, &sid); + } centry_free(centry); |