Fix bug #7528 - Solaris with NIS autohome.
authorJeremy Allison <jra@samba.org>
Wed, 1 Jun 2011 18:38:48 +0000 (20:38 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 14 Jun 2011 10:58:50 +0000 (12:58 +0200)
(cherry picked from commit 0ffdf2288b1e6798e43259568818378c43b979e5)

source3/lib/util.c

index 46be349a2c22d0253642eaecc72ea96e35f078af..238981debc1263cf3a607966f080495dd9748214 100644 (file)
@@ -1312,6 +1312,9 @@ char *automount_lookup(TALLOC_CTX *ctx, const char *user_name)
        if ((nis_error = yp_match(nis_domain, nis_map, user_name,
                                        strlen(user_name), &nis_result,
                                        &nis_result_len)) == 0) {
+               if (nis_result_len > 0 && nis_result[nis_result_len] == '\n') {
+                       nis_result[nis_result_len] = '\0';
+               }
                value = talloc_strdup(ctx, nis_result);
                if (!value) {
                        return NULL;