s3:utils: Initialize the memcache for smbpasswd
authorAndreas Schneider <asn@samba.org>
Thu, 26 Oct 2023 12:37:29 +0000 (14:37 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 27 Oct 2023 06:51:48 +0000 (06:51 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Oct 27 06:51:48 UTC 2023 on atb-devel-224

source3/utils/smbpasswd.c

index 950aaff67da1c224d95739f34fd516db75282c29..f2c5dfd2b0ff84c2377330e1a582340f45d9f19f 100644 (file)
@@ -27,6 +27,7 @@
 #include "passwd_proto.h"
 #include "lib/util/string_wrappers.h"
 #include "lib/param/param.h"
+#include "lib/util/memcache.h"
 
 /*
  * Next two lines needed for SunOS and don't
@@ -620,9 +621,17 @@ int main(int argc, char **argv)
 {
        TALLOC_CTX *frame = talloc_stackframe();
        struct loadparm_context *lp_ctx = NULL;
+       struct memcache *mcache = NULL;
        int local_flags = 0;
        int ret;
 
+       mcache = memcache_init(NULL, 0);
+       if (mcache == NULL) {
+               fprintf(stderr, "%s: memcache_init failed\n", __location__);
+               return 1;
+       }
+       memcache_set_global(mcache);
+
 #if defined(HAVE_SET_AUTH_PARAMETERS)
        set_auth_parameters(argc, argv);
 #endif /* HAVE_SET_AUTH_PARAMETERS */