s3: Make login_cache_write take a pointer
authorVolker Lendecke <vl@samba.org>
Tue, 16 Mar 2010 21:22:21 +0000 (22:22 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 16 Mar 2010 21:35:41 +0000 (22:35 +0100)
source3/include/proto.h
source3/passdb/login_cache.c
source3/passdb/pdb_ldap.c

index 68a3e5cf7b7b867d67d9638bca5ff6cfffc0c763..ad95863d8181bb4ec82ed01598fbc151ae09426f 100644 (file)
@@ -4410,7 +4410,8 @@ char* get_string_param( const char* param );
 bool login_cache_init(void);
 bool login_cache_shutdown(void);
 bool login_cache_read(struct samu *sampass, struct login_cache *entry);
-bool login_cache_write(const struct samu *sampass, struct login_cache entry);
+bool login_cache_write(const struct samu *sampass,
+                      const struct login_cache *entry);
 bool login_cache_delentry(const struct samu *sampass);
 
 /* The following definitions come from passdb/lookup_sid.c  */
index 2f9f000f11108e2507ff49eef24608dbf9d09c9f..cf6c796321cb094fdf1e754bbb05591e849eaa95 100644 (file)
@@ -112,13 +112,14 @@ bool login_cache_read(struct samu *sampass, struct login_cache *entry)
        return true;
 }
 
-bool login_cache_write(const struct samu *sampass, struct login_cache entry)
+bool login_cache_write(const struct samu *sampass,
+                      const struct login_cache *entry)
 {
        char *keystr;
        TDB_DATA databuf;
        bool ret;
        uint32_t entry_timestamp;
-       uint32_t bad_password_time = (uint32_t)entry.bad_password_time;
+       uint32_t bad_password_time = entry->bad_password_time;
 
        if (!login_cache_init())
                return False;
@@ -138,8 +139,8 @@ bool login_cache_write(const struct samu *sampass, struct login_cache entry)
        databuf.dsize = 
                tdb_pack(NULL, 0, SAM_CACHE_FORMAT,
                         entry_timestamp,
-                        entry.acct_ctrl,
-                        entry.bad_password_count,
+                        entry->acct_ctrl,
+                        entry->bad_password_count,
                         bad_password_time);
        databuf.dptr = SMB_MALLOC_ARRAY(uint8, databuf.dsize);
        if (!databuf.dptr) {
@@ -149,8 +150,8 @@ bool login_cache_write(const struct samu *sampass, struct login_cache entry)
 
        if (tdb_pack(databuf.dptr, databuf.dsize, SAM_CACHE_FORMAT,
                         entry_timestamp,
-                        entry.acct_ctrl,
-                        entry.bad_password_count,
+                        entry->acct_ctrl,
+                        entry->bad_password_count,
                         bad_password_time)
            != databuf.dsize) {
                SAFE_FREE(keystr);
index b3eb37501c04a99197206e318e93a332bce24c2e..4ff718ebdb2006fc38fc247e499197d597652e5f 100644 (file)
@@ -1518,7 +1518,7 @@ static bool init_ldap_from_sam (struct ldapsam_privates *ldap_state,
                        cache_entry.bad_password_time = badtime;
 
                        DEBUG(7, ("Updating bad password count and time in login cache\n"));
-                       login_cache_write(sampass, cache_entry);
+                       login_cache_write(sampass, &cache_entry);
                }
        }