s3-includes: only include system/filesys.h when needed.
[vlendec/samba-autobuild/.git] / source3 / libsmb / samlogon_cache.c
index 2e7a9c6b031b2270af6fe5e6c0c02b335ccead42..facdbc7dc194f6fa77c9cd79c0c15aeba1840436 100644 (file)
@@ -22,6 +22,7 @@
 */
 
 #include "includes.h"
+#include "system/filesys.h"
 #include "librpc/gen_ndr/ndr_krb5pac.h"
 #include "../libcli/security/security.h"
 
@@ -99,14 +100,9 @@ bool netsamlogon_cache_shutdown(void)
  Clear cache getpwnam and getgroups entries from the winbindd cache
 ***********************************************************************/
 
-void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3)
+void netsamlogon_clear_cached_user(const struct dom_sid *user_sid)
 {
-       struct dom_sid  user_sid;
-       fstring keystr, tmp;
-
-       if (!info3) {
-               return;
-       }
+       fstring keystr;
 
        if (!netsamlogon_cache_init()) {
                DEBUG(0,("netsamlogon_clear_cached_user: cannot open "
@@ -114,10 +110,9 @@ void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3)
                        NETSAMLOGON_TDB));
                return;
        }
-       sid_compose(&user_sid, info3->base.domain_sid, info3->base.rid);
 
        /* Prepare key as DOMAIN-SID/USER-RID string */
-       slprintf(keystr, sizeof(keystr), "%s", sid_to_fstring(tmp, &user_sid));
+       sid_to_fstring(keystr, user_sid);
 
        DEBUG(10,("netsamlogon_clear_cached_user: SID [%s]\n", keystr));
 
@@ -132,7 +127,7 @@ void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3)
 bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3)
 {
        TDB_DATA data;
-       fstring keystr, tmp;
+       fstring keystr;
        bool result = false;
        struct dom_sid  user_sid;
        time_t t = time(NULL);
@@ -154,7 +149,7 @@ bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3)
        sid_compose(&user_sid, info3->base.domain_sid, info3->base.rid);
 
        /* Prepare key as DOMAIN-SID/USER-RID string */
-       slprintf(keystr, sizeof(keystr), "%s", sid_to_fstring(tmp, &user_sid));
+       sid_to_fstring(keystr, &user_sid);
 
        DEBUG(10,("netsamlogon_cache_store: SID [%s]\n", keystr));