]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libnet_join: remove dead code from libnet_join_connect_ads()
authorStefan Metzmacher <metze@samba.org>
Wed, 17 May 2017 10:42:04 +0000 (12:42 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 13 Jul 2017 08:51:17 +0000 (10:51 +0200)
username[strlen(username)] is *always* '\0'!

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 5958c6790fbceb39065353c07fe25f74ddf09ef0)

source3/libnet/libnet_join.c

index 0eee286c77970e312f18022e87847d3483b9f0d6..5089f25967b974f59e46ebfe5e523e102ff830dc 100644 (file)
@@ -195,16 +195,11 @@ static ADS_STATUS libnet_join_connect_ads(TALLOC_CTX *mem_ctx,
                    r->in.machine_password == NULL) {
                        return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER);
                }
-               username = talloc_strdup(mem_ctx, r->in.machine_name);
+               username = talloc_asprintf(mem_ctx, "%s$",
+                                          r->in.machine_name);
                if (username == NULL) {
                        return ADS_ERROR(LDAP_NO_MEMORY);
                }
-               if (username[strlen(username)] != '$') {
-                       username = talloc_asprintf(username, "%s$", username);
-                       if (username == NULL) {
-                               return ADS_ERROR(LDAP_NO_MEMORY);
-                       }
-               }
                password = r->in.machine_password;
                ccname = "MEMORY:libnet_join_machine_creds";
        } else {