]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/winbindd: in winbindd_pam_logoff_send use canonicalize_username
authorNoel Power <noel.power@suse.com>
Sat, 21 Oct 2023 11:13:19 +0000 (12:13 +0100)
committerNoel Power <npower@samba.org>
Tue, 24 Oct 2023 12:43:37 +0000 (12:43 +0000)
replace use of canonicalize_username_fstr with canonicalize_username

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/winbindd/winbindd_pam_logoff.c

index b4c1e62b5b7da20f284b96ba0af992de5890588a..c799eb5e38d399c8f62ffa9f43de4d71b9ac66bd 100644 (file)
@@ -22,6 +22,7 @@
 #include "winbindd.h"
 #include "lib/global_contexts.h"
 #include "librpc/gen_ndr/ndr_winbind_c.h"
+#include "lib/util/string_wrappers.h"
 
 struct winbindd_pam_logoff_state {
        struct wbint_PamLogOff r;
@@ -37,7 +38,11 @@ struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req, *subreq;
        struct winbindd_pam_logoff_state *state;
        struct winbindd_domain *domain;
-       fstring name_namespace, name_domain, user;
+       char *name_namespace = NULL;
+       char *name_domain = NULL;
+       char *user = NULL;
+       char *logoff_user = NULL;
+
        uid_t caller_uid;
        gid_t caller_gid;
        int res;
@@ -63,14 +68,19 @@ struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx,
                goto failed;
        }
 
-       ok = canonicalize_username_fstr(request->data.logoff.user,
-                                  name_namespace,
-                                  name_domain,
-                                  user);
+       logoff_user = request->data.logoff.user;
+
+       ok = canonicalize_username(req,
+                                  &logoff_user,
+                                  &name_namespace,
+                                  &name_domain,
+                                  &user);
        if (!ok) {
                goto failed;
        }
 
+       fstrcpy(request->data.logoff.user, logoff_user);
+
        domain = find_auth_domain(request->flags, name_namespace);
        if (domain == NULL) {
                goto failed;