From bad1b289ede4448ff14c1211f0ff4234c465ac7c Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 30 Jan 2012 12:37:17 -0500 Subject: [PATCH] Random chmod() and chown() calls to help things out when we start up citserver in an empty directory --- citadel/citadel_ldap.h | 12 +++--------- citadel/clientsocket.h | 12 +++--------- citadel/config.c | 24 +++++++++++++----------- citadel/config.h | 12 +++--------- citadel/control.h | 12 +++--------- citadel/database.h | 12 +++--------- citadel/domain.h | 12 +++--------- citadel/msgbase.c | 16 +++++----------- 8 files changed, 36 insertions(+), 76 deletions(-) diff --git a/citadel/citadel_ldap.h b/citadel/citadel_ldap.h index b401cc9f1..9ec1d9269 100644 --- a/citadel/citadel_ldap.h +++ b/citadel/citadel_ldap.h @@ -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); diff --git a/citadel/clientsocket.h b/citadel/clientsocket.h index c430c1882..f0d7c6a32 100644 --- a/citadel/clientsocket.h +++ b/citadel/clientsocket.h @@ -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); diff --git a/citadel/config.c b/citadel/config.c index cc48c8d11..78a01d074 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -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)); } diff --git a/citadel/config.h b/citadel/config.h index 22a96b1d1..cc4a92ac4 100644 --- a/citadel/config.h +++ b/citadel/config.h @@ -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" diff --git a/citadel/control.h b/citadel/control.h index daaa5eeb0..c08f4f266 100644 --- a/citadel/control.h +++ b/citadel/control.h @@ -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); diff --git a/citadel/database.h b/citadel/database.h index 67aa610b1..f693f65cf 100644 --- a/citadel/database.h +++ b/citadel/database.h @@ -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 diff --git a/citadel/domain.h b/citadel/domain.h index 664d61fd3..ba367593d 100644 --- a/citadel/domain.h +++ b/citadel/domain.h @@ -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 { diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 824b51bd3..f49f1cc64 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -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); -- 2.30.2