Bug 10853 - net ads join failed with error if samba/var folder is empty
Summary: net ads join failed with error if samba/var folder is empty
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Andrew Bartlett
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-03 19:09 UTC by YOUZHONG YANG
Modified: 2014-10-13 10:52 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description YOUZHONG YANG 2014-10-03 19:09:36 UTC
Here is the error message:

mkdir failed on directory /.../samba/var/cache/lck: No such file or directory
Could not initialise message context. Try running as root
Failed to join domain: Access is denied

The issue was fixed with the following patch, not sure if it is the best place to create the var/cache folder:

diff --git a/source3/lib/messages_dgm.c b/source3/lib/messages_dgm.c
index ae35282..d2f2f7b 100644
--- a/source3/lib/messages_dgm.c
+++ b/source3/lib/messages_dgm.c
@@ -226,6 +226,12 @@ int messaging_dgm_init(struct tevent_context *ev,
                return ENAMETOOLONG;
        }

+       ok = directory_create_or_exist_strict(cache_dir, dir_owner, 0755);
+       if (!ok) {
+               DEBUG(0, ("Could not create cache directory: %s\n", cache_dir));
+               TALLOC_FREE(ctx);
+               return EACCES;
+       }
        ret = messaging_dgm_lockfile_create(cache_dir, dir_owner, pid.pid,
                                            &ctx->lockfile_fd, pid.unique_id);
        if (ret != 0) {
Comment 1 Jeremy Allison 2014-10-07 18:24:33 UTC
I appreciate the patch, but I don't think this is the right place to fix it. Probably this should be done inside the net join code itself, once we know we're running as root...