Random chmod() and chown() calls to help things out when we start up citserver in...
authorArt Cancro <ajc@uncensored.citadel.org>
Mon, 30 Jan 2012 17:37:17 +0000 (12:37 -0500)
committerArt Cancro <ajc@uncensored.citadel.org>
Mon, 30 Jan 2012 17:37:17 +0000 (12:37 -0500)
citadel/citadel_ldap.h
citadel/clientsocket.h
citadel/config.c
citadel/config.h
citadel/control.h
citadel/database.h
citadel/domain.h
citadel/msgbase.c

index b401cc9f1cab8b6037ff6fd7002b91d8d2cd5999..9ec1d92693cbe579802a67136df519d09cb54e12 100644 (file)
@@ -1,21 +1,15 @@
 /*
  * Configuration for LDAP authentication.  Most of this stuff gets pulled out of our site config file.
  *
- * Copyright (c) 1987-2009 by the citadel.org team
+ * Copyright (c) 1987-2012 by the citadel.org team
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
+ *  This program is open source software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 3.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 int CtdlTryUserLDAP(char *username, char *found_dn, int found_dn_size, char *fullname, int fullname_size, uid_t *found_uid);
index c430c1882aad99164fb682fb93dddea715cb8079..f0d7c6a32591c2e99f5252588ff1178b03ca2ec5 100644 (file)
@@ -1,21 +1,15 @@
 /*
  * Header file for TCP client socket library
  *
- * Copyright (c) 1987-2009 by the citadel.org team
+ * Copyright (c) 1987-2012 by the citadel.org team
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
+ *  This program is open source software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 3.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 int sock_connect(char *host, char *service);
index cc48c8d11c7f3a586e5650d178e0a01e04a2595c..78a01d074c6358fefe1911450aa06cbad551894f 100644 (file)
@@ -130,7 +130,8 @@ void get_config(void) {
                {
                        fprintf(stderr, 
                                "Warning: The config file %s has unexpected size. \n",
-                               file_citadel_config);
+                               file_citadel_config
+                       );
                }
                fclose(cfp);
        }
@@ -206,15 +207,16 @@ void get_config(void) {
 void put_config(void)
 {
        FILE *cfp;
-       int rv;
-
-       if ((cfp = fopen(file_citadel_config, "rb+")) == NULL)
-               perror(file_citadel_config);
-       else {
-               rv = fwrite((char *) &config, sizeof(struct config), 1, cfp);
-               if (rv == -1)
-                       syslog(LOG_EMERG, "Failed to write: %s [%s]\n", 
-                              file_citadel_config, strerror(errno));
-               fclose(cfp);
+       int blocks_written = 0;
+
+       if ((cfp = fopen(file_citadel_config, "w")) != NULL) {
+               blocks_written = fwrite((char *) &config, sizeof(struct config), 1, cfp);
+               if (blocks_written == 1) {
+                       fclose(cfp);
+                       chown(file_citadel_config, CTDLUID, (-1));
+                       chmod(file_citadel_config, 0600);
+                       return;
+               }
        }
+       syslog(LOG_EMERG, "%s: %s", file_citadel_config, strerror(errno));
 }
index 22a96b1d1947b6796bed6d72e30b2159e955aff5..cc4a92ac4e6234a1c45bdafe523a23a03dad0df5 100644 (file)
@@ -1,19 +1,13 @@
 /*
- * Copyright (c) 1987-2009 by the citadel.org team
+ * Copyright (c) 1987-2012 by the citadel.org team
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
+ *  This program is open source software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 3.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include "serv_extensions.h"
index daaa5eeb081756da0e184e7177afcc37e6de1904..c08f4f26684f082f641862e04c0d11d796367d16 100644 (file)
@@ -1,19 +1,13 @@
 /*
- * Copyright (c) 1987-2009 by the citadel.org team
+ * Copyright (c) 1987-2012 by the citadel.org team
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
+ *  This program is open source software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 3.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 void get_control (void);
index 67aa610b1692137ccddc15fbb749b84de66d71cb..f693f65cfee84113c011682cc2e2e71b9c80d8c8 100644 (file)
@@ -1,19 +1,13 @@
 /*
- * Copyright (c) 1987-2009 by the citadel.org team
+ * Copyright (c) 1987-2012 by the citadel.org team
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
+ *  This program is open source software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 3.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #ifndef DATABASE_H
index 664d61fd3380f60aa90155a3e9d6e48c806c43dd..ba367593d643dcbef31b0407117e95fbe0652017 100644 (file)
@@ -1,19 +1,13 @@
 /*
- * Copyright (c) 1987-2009 by the citadel.org team
+ * Copyright (c) 1987-2012 by the citadel.org team
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * This program is open source software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 struct mx {
index 824b51bd337974b232da9bd2644ccaed22db1085..f49f1cc649433ff324fe2801cb6863259277e455 100644 (file)
@@ -1,21 +1,15 @@
 /*
  * Implements the message store.
  *
- * Copyright (c) 1987-2011 by the citadel.org team
+ * Copyright (c) 1987-2012 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * it under the terms of the GNU General Public License version 3.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include "sysdep.h"
@@ -4936,13 +4930,13 @@ void AdjRefCount(long msgnum, int incr)
        struct arcq new_arcq;
        int rv = 0;
 
-       syslog(LOG_DEBUG, "AdjRefCount() msg %ld ref count delta %+d\n",
-              msgnum, incr
-               );
+       syslog(LOG_DEBUG, "AdjRefCount() msg %ld ref count delta %+d\n", msgnum, incr);
 
        begin_critical_section(S_SUPPMSGMAIN);
        if (arcfp == NULL) {
                arcfp = fopen(file_arcq, "ab+");
+               chown(file_arcq, CTDLUID, (-1));
+               chmod(file_arcq, 0600);
        }
        end_critical_section(S_SUPPMSGMAIN);