lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1795 - nss-pam-ldapd/nslcd

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1795 - nss-pam-ldapd/nslcd



Author: arthur
Date: Sun Oct 14 16:51:29 2012
New Revision: 1795
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1795&view=revision

Log:
if nslcd creates the state directory, try to set the right ownership

Modified:
   nss-pam-ldapd/nslcd/nslcd.c

Modified: nss-pam-ldapd/nslcd/nslcd.c
==============================================================================
--- nss-pam-ldapd/nslcd/nslcd.c Sat Oct 13 23:41:31 2012        (r1794)
+++ nss-pam-ldapd/nslcd/nslcd.c Sun Oct 14 16:51:29 2012        (r1795)
@@ -273,10 +273,16 @@
 /* create the directory for the specified file to reside in */
 static void mkdirname(const char *filename)
 {
-  char *tmpname;
+  char *tmpname,*path;
   tmpname=strdup(filename);
   if (tmpname==NULL) return;
-  (void)mkdir(dirname(tmpname),(mode_t)0755);
+  path=dirname(tmpname);
+  if (mkdir(path,(mode_t)0755)==0)
+  {
+    /* if directory was just created, set correct ownership */
+    if (lchown(path,nslcd_cfg->ldc_uid,nslcd_cfg->ldc_gid)<0)
+      log_log(LOG_WARNING,"problem setting permissions for %s: 
%s",path,strerror(errno));
+  }
   free(tmpname);
 }
 
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/