From 57b37d4ed168b176d594bc149e5d16a1b9f0517a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 13 Jan 2012 14:20:13 -0500 Subject: [PATCH] Began setting up a second server socket that will be used exclusively for admin utilities --- citadel/file_ops.c | 3 +- citadel/include/citadel_dirs.h | 1 + citadel/modules/extnotify/extnotify_main.c | 1 - citadel/parsedate.c | 520 +++++++++++---------- citadel/server_main.c | 13 +- citadel/utillib/citadel_dirs.c | 19 +- citadel/utils/chkpw.c | 2 +- citadel/utils/sendcommand.c | 35 +- 8 files changed, 321 insertions(+), 273 deletions(-) diff --git a/citadel/file_ops.c b/citadel/file_ops.c index 69e49c45e..207a4b190 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -156,7 +156,6 @@ void cmd_movf(char *cmdbuf) char buf[PATH_MAX]; int a; struct ctdlroom qrbuf; - int rv = 0; extract_token(filename, cmdbuf, 0, '|', sizeof filename); extract_token(newroom, cmdbuf, 1, '|', sizeof newroom); @@ -210,7 +209,7 @@ void cmd_movf(char *cmdbuf) snprintf(buf, sizeof buf, "cat ./files/%s/filedir |grep \"%s\" >>./files/%s/filedir", CC->room.QRdirname, filename, qrbuf.QRdirname); - rv = system(buf); + system(buf); cprintf("%d File '%s' has been moved.\n", CIT_OK, filename); } diff --git a/citadel/include/citadel_dirs.h b/citadel/include/citadel_dirs.h index b6039e1d9..51929cc63 100644 --- a/citadel/include/citadel_dirs.h +++ b/citadel/include/citadel_dirs.h @@ -44,6 +44,7 @@ extern char file_lmtp_socket[PATH_MAX]; extern char file_lmtp_unfiltered_socket[PATH_MAX]; extern char file_arcq[PATH_MAX]; extern char file_citadel_socket[PATH_MAX]; +extern char file_citadel_admin_socket[PATH_MAX]; extern char file_mail_aliases[PATH_MAX]; extern char file_pid_file[PATH_MAX]; extern char file_pid_paniclog[PATH_MAX]; diff --git a/citadel/modules/extnotify/extnotify_main.c b/citadel/modules/extnotify/extnotify_main.c index 123a8771b..51e4e13e5 100644 --- a/citadel/modules/extnotify/extnotify_main.c +++ b/citadel/modules/extnotify/extnotify_main.c @@ -276,7 +276,6 @@ void process_notify(long NotifyMsgnum, void *usrdata) char remoteurl[SIZ]; char *FreeMe = NULL; char *PagerNo; - CitContext *SubC; Ctx = (NotifyContext*) usrdata; diff --git a/citadel/parsedate.c b/citadel/parsedate.c index ef584417f..67342a5d1 100644 --- a/citadel/parsedate.c +++ b/citadel/parsedate.c @@ -1,12 +1,10 @@ +/* A Bison parser, made by GNU Bison 2.5. */ -/* A Bison parser, made by GNU Bison 2.4.1. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is open source software; you can redistribute it and/or modify + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + + 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. @@ -46,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -67,7 +65,7 @@ /* Copy the first part of user declarations. */ -/* Line 189 of yacc.c */ +/* Line 268 of yacc.c */ #line 1 "parsedate.y" /* $Revision$ @@ -193,8 +191,8 @@ static time_t yyRelSeconds; static void date_error(char *); -/* Line 189 of yacc.c */ -#line 198 "y.tab.c" +/* Line 268 of yacc.c */ +#line 196 "y.tab.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -250,15 +248,18 @@ static void date_error(char *); typedef union YYSTYPE { -/* Line 214 of yacc.c */ +/* Line 293 of yacc.c */ #line 125 "parsedate.y" time_t Number; enum _MERIDIAN Meridian; -} -/* Line 193 of yacc.c. */ -#line 247 "y.tab.c" - YYSTYPE; + + + +/* Line 293 of yacc.c */ +#line 261 "y.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif @@ -267,8 +268,8 @@ typedef union YYSTYPE /* Copy the second part of user declarations. */ -/* Line 264 of yacc.c */ -#line 275 "y.tab.c" +/* Line 343 of yacc.c */ +#line 273 "y.tab.c" #ifdef short # undef short @@ -318,7 +319,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -371,11 +372,11 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -398,24 +399,24 @@ YYID (yyi) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif @@ -444,23 +445,7 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of @@ -480,6 +465,26 @@ union yyalloc #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ @@ -609,8 +614,8 @@ static const yytype_uint8 yyr2[] = 1 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { @@ -647,8 +652,7 @@ static const yytype_int8 yypgoto[] = /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ + number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { @@ -659,6 +663,12 @@ static const yytype_uint8 yytable[] = 41 }; +#define yypact_value_is_default(yystate) \ + ((yystate) == (-29)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + static const yytype_int8 yycheck[] = { 24, 0, 30, 14, 3, 5, 30, 6, 4, 9, @@ -691,9 +701,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -703,7 +722,6 @@ do \ { \ yychar = (Token); \ yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -745,19 +763,10 @@ while (YYID (0)) #endif -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ +/* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif @@ -949,7 +958,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -1052,115 +1060,142 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = 0; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } - if (yysize_overflow) - return YYSIZE_MAXIMUM; + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1193,6 +1228,7 @@ yydestruct (yymsg, yytype, yyvaluep) } } + /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus @@ -1219,10 +1255,9 @@ YYSTYPE yylval; int yynerrs; - -/*-------------------------. -| yyparse or yypush_parse. | -`-------------------------*/ +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1246,8 +1281,6 @@ yyparse () #endif #endif { - - int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1402,7 +1435,7 @@ yybackup: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -1433,8 +1466,8 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1489,7 +1522,7 @@ yyreduce: { case 4: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 143 "parsedate.y" { yyHaveTime++; @@ -1504,7 +1537,7 @@ yyreduce: case 5: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 152 "parsedate.y" { yyHaveTime++; @@ -1514,7 +1547,7 @@ yyreduce: case 6: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 156 "parsedate.y" { yyHaveDate++; @@ -1523,7 +1556,7 @@ yyreduce: case 7: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 159 "parsedate.y" { yyHaveRel = 1; @@ -1532,7 +1565,7 @@ yyreduce: case 8: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 164 "parsedate.y" { if ((yyvsp[(1) - (2)].Number) < 100) { @@ -1550,7 +1583,7 @@ yyreduce: case 9: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 176 "parsedate.y" { yyHour = (yyvsp[(1) - (4)].Number); @@ -1562,7 +1595,7 @@ yyreduce: case 10: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 182 "parsedate.y" { yyHour = (yyvsp[(1) - (4)].Number); @@ -1575,7 +1608,7 @@ yyreduce: case 11: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 189 "parsedate.y" { yyHour = (yyvsp[(1) - (6)].Number); @@ -1587,7 +1620,7 @@ yyreduce: case 12: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 195 "parsedate.y" { yyHour = (yyvsp[(1) - (6)].Number); @@ -1601,7 +1634,7 @@ yyreduce: case 13: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 205 "parsedate.y" { (yyval.Number) = (yyvsp[(1) - (1)].Number); @@ -1611,7 +1644,7 @@ yyreduce: case 14: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 209 "parsedate.y" { (yyval.Number) = (yyvsp[(1) - (1)].Number); @@ -1621,7 +1654,7 @@ yyreduce: case 15: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 213 "parsedate.y" { /* Only allow "GMT+300" and "GMT-0800" */ @@ -1635,7 +1668,7 @@ yyreduce: case 16: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 221 "parsedate.y" { (yyval.Number) = (yyvsp[(1) - (1)].Number); @@ -1645,7 +1678,7 @@ yyreduce: case 17: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 227 "parsedate.y" { int i; @@ -1670,7 +1703,7 @@ yyreduce: case 18: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 248 "parsedate.y" { yyMonth = (yyvsp[(1) - (3)].Number); @@ -1680,7 +1713,7 @@ yyreduce: case 19: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 252 "parsedate.y" { if ((yyvsp[(1) - (5)].Number) > 100) { @@ -1698,7 +1731,7 @@ yyreduce: case 20: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 264 "parsedate.y" { yyMonth = (yyvsp[(1) - (2)].Number); @@ -1708,7 +1741,7 @@ yyreduce: case 21: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 268 "parsedate.y" { yyMonth = (yyvsp[(1) - (4)].Number); @@ -1719,7 +1752,7 @@ yyreduce: case 22: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 273 "parsedate.y" { yyDay = (yyvsp[(1) - (2)].Number); @@ -1729,7 +1762,7 @@ yyreduce: case 23: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 277 "parsedate.y" { yyDay = (yyvsp[(1) - (3)].Number); @@ -1740,7 +1773,7 @@ yyreduce: case 24: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 282 "parsedate.y" { yyDay = (yyvsp[(3) - (5)].Number); @@ -1751,7 +1784,7 @@ yyreduce: case 25: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 289 "parsedate.y" { yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number); @@ -1760,7 +1793,7 @@ yyreduce: case 26: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 292 "parsedate.y" { yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number); @@ -1769,7 +1802,7 @@ yyreduce: case 27: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 295 "parsedate.y" { yyRelMonth += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number); @@ -1778,7 +1811,7 @@ yyreduce: case 28: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 298 "parsedate.y" { yyRelMonth += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number); @@ -1787,7 +1820,7 @@ yyreduce: case 29: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 303 "parsedate.y" { (yyval.Meridian) = MER24; @@ -1796,7 +1829,7 @@ yyreduce: case 30: -/* Line 1455 of yacc.c */ +/* Line 1806 of yacc.c */ #line 306 "parsedate.y" { (yyval.Meridian) = (yyvsp[(1) - (1)].Meridian); @@ -1805,10 +1838,21 @@ yyreduce: -/* Line 1455 of yacc.c */ -#line 1813 "y.tab.c" +/* Line 1806 of yacc.c */ +#line 1843 "y.tab.c" default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -1836,6 +1880,10 @@ yyreduce: | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { @@ -1843,37 +1891,36 @@ yyerrlab: #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -1932,7 +1979,7 @@ yyerrlab1: for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -1991,8 +2038,13 @@ yyexhaustedlab: yyreturn: if (yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -2017,7 +2069,7 @@ yyreturn: -/* Line 1675 of yacc.c */ +/* Line 2067 of yacc.c */ #line 311 "parsedate.y" diff --git a/citadel/server_main.c b/citadel/server_main.c index 592ea7708..ff216ba76 100644 --- a/citadel/server_main.c +++ b/citadel/server_main.c @@ -279,7 +279,7 @@ int main(int argc, char **argv) } /* - * Bind the server to a Unix-domain socket. + * Bind the server to a Unix-domain socket (user client access) */ CtdlRegisterServiceHook(0, file_citadel_socket, @@ -288,6 +288,17 @@ int main(int argc, char **argv) do_async_loop, CitadelServiceUDS); + /* + * Bind the server to a Unix-domain socket (admin client access) + */ + CtdlRegisterServiceHook(0, + file_citadel_admin_socket, + citproto_begin_session, + do_command_loop, + do_async_loop, + CitadelServiceUDS); + chmod(file_citadel_admin_socket, S_IRWXU); /* for your eyes only */ + /* * Bind the server to our favorite TCP port (usually 504). */ diff --git a/citadel/utillib/citadel_dirs.c b/citadel/utillib/citadel_dirs.c index 8037b6d12..a88417954 100644 --- a/citadel/utillib/citadel_dirs.c +++ b/citadel/utillib/citadel_dirs.c @@ -1,21 +1,15 @@ /* * citadel_dirs.c : calculate pathnames for various files used in the Citadel system * - * 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 #include @@ -24,7 +18,6 @@ #include #include - #if TIME_WITH_SYS_TIME # include # include @@ -79,6 +72,7 @@ char file_lmtp_socket[PATH_MAX]=""; char file_lmtp_unfiltered_socket[PATH_MAX]=""; char file_arcq[PATH_MAX]=""; char file_citadel_socket[PATH_MAX]=""; +char file_citadel_admin_socket[PATH_MAX]=""; char file_mail_aliases[PATH_MAX]=""; char file_pid_file[PATH_MAX]=""; char file_pid_paniclog[PATH_MAX]=""; @@ -264,6 +258,11 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char *ctdldir, "%scitadel.socket", ctdl_run_dir); StripSlashes(file_citadel_socket, 0); + snprintf(file_citadel_admin_socket, + sizeof file_citadel_admin_socket, + "%scitadel-admin.socket", + ctdl_run_dir); + StripSlashes(file_citadel_admin_socket, 0); snprintf(file_pid_file, sizeof file_pid_file, "%scitadel.pid", diff --git a/citadel/utils/chkpw.c b/citadel/utils/chkpw.c index fb37fc862..766d50fa9 100644 --- a/citadel/utils/chkpw.c +++ b/citadel/utils/chkpw.c @@ -122,7 +122,7 @@ int main(int argc, char **argv) { struct passwd *p; int uid; char ctdldir[PATH_MAX]=CTDLDIR; - char *ptr; + char *ptr = NULL; calc_dirs_n_files(0,0,"", ctdldir, 0); diff --git a/citadel/utils/sendcommand.c b/citadel/utils/sendcommand.c index c0870f62b..71764bcbb 100644 --- a/citadel/utils/sendcommand.c +++ b/citadel/utils/sendcommand.c @@ -1,21 +1,15 @@ /* * Command-line utility to transmit a server command. * - * Copyright (c) 1987-2010 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 "ctdl_module.h" @@ -71,15 +65,8 @@ void nq_cleanup(int e) void serv_write(CtdlIPC *ipc, const char *buf, unsigned int nbytes) { unsigned int bytes_written = 0; - int retval; -/* -#if defined(HAVE_OPENSSL) - if (ipc->ssl) { - serv_write_ssl(ipc, buf, nbytes); - return; - } -#endif -*/ + int retval = 0; + while (bytes_written < nbytes) { retval = write(ipc->sock, &buf[bytes_written], nbytes - bytes_written); @@ -179,19 +166,19 @@ int main(int argc, char **argv) for (a = 1; a < argc; ++a) { if (!strncmp(argv[a], "-h", 2)) { relh=argv[a][2]!='/'; - if (!relh) safestrncpy(ctdl_home_directory, &argv[a][2], - sizeof ctdl_home_directory); - else - safestrncpy(relhome, &argv[a][2], - sizeof relhome); + if (!relh) safestrncpy(ctdl_home_directory, &argv[a][2], sizeof ctdl_home_directory); + else { + safestrncpy(relhome, &argv[a][2], sizeof relhome); + } home=1; } else if (!strncmp(argv[a], "-w", 2)) { watchdog = atoi(&argv[a][2]); if (watchdog<1) watchdog=1; } else { - if (!IsEmptyStr(cmd)) + if (!IsEmptyStr(cmd)) { strcat(cmd, " "); + } strcat(cmd, argv[a]); } } -- 2.30.2