~ubuntu-branches/ubuntu/hardy/mailman/hardy-updates

« back to all changes in this revision

Viewing changes to src/common.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-07-03 16:59:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060703165925-175ubna955u796c0
Tags: 0:2.1.8-1ubuntu1
* Merge to Debian; remaining Ubuntu changes:
  - debian/mailman.init: Create /var/{run,lock}/mailman.
  - debian/control: exim4 -> postfix.
* debian/control: Dependency fix: apache -> apache2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* common.c --- Common routines, constants, etc.  Used by all the wrappers.
2
2
 *
3
 
 * Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
 
3
 * Copyright (C) 1998-2005 by the Free Software Foundation, Inc.
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or
6
6
 * modify it under the terms of the GNU General Public License
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 
18
 * USA.
18
19
 */
19
20
 
20
21
#include "common.h"
63
64
{
64
65
#ifndef HAVE_VSNPRINTF
65
66
        /* A replacement is provided in vsnprintf.c for ancient systems still
66
 
         * lacking one in their C library.
67
 
         */
 
67
         * lacking one in their C library.
 
68
         */
68
69
        int vsnprintf(char*, size_t, const char*, va_list);
69
70
#endif /* !HAVE_VSNPRINTF */
70
71
 
99
100
                printf("<title>Mailman CGI error!!!</title>\n");
100
101
                printf("</head><body>\n");
101
102
                printf("<h1>Mailman CGI error!!!</h1>\n");
102
 
                printf("The Mailman CGI wrapper encountered a fatal error. ");
103
 
                printf("This entry is being stored in your syslog:");
 
103
                printf("The Mailman CGI wrapper encountered a fatal error. ");
 
104
                printf("This entry is being stored in your syslog:");
104
105
                printf("\n<pre>\n");
105
106
                printf(log_entry);
106
107
                printf("</pre>\n");
119
120
check_caller(const char* ident, const char* parentgroup)
120
121
{
121
122
        GID_T mygid = getgid();
122
 
        struct group *mygroup = getgrgid(mygid);
123
 
        char* option;
124
 
        char* server;
125
 
        char* wrapper;
126
 
 
127
 
        if (running_as_cgi) {
128
 
                option = "--with-cgi-gid";
129
 
                server = "web";
130
 
                wrapper = "CGI";
131
 
        }
132
 
        else {
133
 
                option = "--with-mail-gid";
134
 
                server = "mail";
135
 
                wrapper = "mail";
136
 
        }
137
 
 
138
 
        if (!mygroup)
139
 
                fatal(ident, GROUP_NAME_NOT_FOUND,
140
 
                      "Failure to find group name %s.  Try adding this group\n"
141
 
                      "to your system, or re-run configure, providing an\n"
142
 
                      "existing group name with the command line option %s.",
143
 
                      parentgroup, option);
 
123
        struct group *mygroup = getgrgid(mygid);
 
124
        char* option;
 
125
        char* server;
 
126
        char* wrapper;
 
127
 
 
128
        if (running_as_cgi) {
 
129
                option = "--with-cgi-gid";
 
130
                server = "web";
 
131
                wrapper = "CGI";
 
132
        }
 
133
        else {
 
134
                option = "--with-mail-gid";
 
135
                server = "mail";
 
136
                wrapper = "mail";
 
137
        }
 
138
 
 
139
        if (!mygroup)
 
140
                fatal(ident, GROUP_NAME_NOT_FOUND,
 
141
                      "Failure to find group name for GID %d.  Mailman\n"
 
142
                      "expected the %s wrapper to be executed as group\n"
 
143
                      "\"%s\", but the system's %s server executed the\n"
 
144
                      "wrapper as GID %d for which the name could not be\n"
 
145
                      "found.  Try adding GID %d to your system as \"%s\",\n"
 
146
                      "or tweak your %s server to run the wrapper as group\n"
 
147
                      "\"%s\".",
 
148
                      mygid, wrapper, parentgroup, server, mygid, mygid,
 
149
                      parentgroup, server, parentgroup);
144
150
 
145
151
        if (strcmp(parentgroup, mygroup->gr_name))
146
152
                fatal(ident, GROUP_MISMATCH,
147
 
                      "Group mismatch error.  Mailman expected the %s\n"
148
 
                      "wrapper script to be executed as group \"%s\", but\n"
149
 
                      "the system's %s server executed the %s script as\n"
150
 
                      "group \"%s\".  Try tweaking the %s server to run the\n"
151
 
                      "script as group \"%s\", or re-run configure, \n"
152
 
                      "providing the command line option `%s=%s'.",
153
 
                      wrapper, parentgroup, server, wrapper, mygroup->gr_name,
154
 
                      server, parentgroup, option, mygroup->gr_name);
 
153
                      "Group mismatch error.  Mailman expected the %s\n"
 
154
                      "wrapper script to be executed as group \"%s\", but\n"
 
155
                      "the system's %s server executed the %s script as\n"
 
156
                      "group \"%s\".  Try tweaking the %s server to run the\n"
 
157
                      "script as group \"%s\", or re-run configure, \n"
 
158
                      "providing the command line option `%s=%s'.",
 
159
                      wrapper, parentgroup, server, wrapper, mygroup->gr_name,
 
160
                      server, parentgroup, option, mygroup->gr_name);
155
161
}
156
162
 
157
163
 
295
301
/*
296
302
 * Local Variables:
297
303
 * c-file-style: "python"
 
304
 * indent-tabs-mode: nil
298
305
 * End:
299
306
 */