]> git.decadent.org.uk Git - nfs-utils.git/blob - support/nfs/exports.c
mount.nfs: Fix retry= to handle lack of reserved port situation
[nfs-utils.git] / support / nfs / exports.c
1 /*
2  * support/nfs/export.c
3  *
4  * Parse the exports file. Derived from the unfsd implementation.
5  *
6  * Authors:     Donald J. Becker, <becker@super.org>
7  *              Rick Sladkey, <jrs@world.std.com>
8  *              Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
9  *              Olaf Kirch, <okir@monad.swb.de>
10  *              Alexander O. Yuriev, <alex@bach.cis.temple.edu>
11  *
12  *              This software maybe be used for any purpose provided
13  *              the above copyright notice is retained.  It is supplied
14  *              as is, with no warranty expressed or implied.
15  */
16
17 #ifdef HAVE_CONFIG_H
18 #include <config.h>
19 #endif
20
21 #include <sys/param.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <stdio.h>
25 #include <ctype.h>
26 #include <unistd.h>
27 #include <errno.h>
28 #include "nfslib.h"
29 #include "exportfs.h"
30 #include "xmalloc.h"
31 #include "xlog.h"
32 #include "xio.h"
33
34 #define EXPORT_DEFAULT_FLAGS    \
35   (NFSEXP_READONLY|NFSEXP_ROOTSQUASH|NFSEXP_GATHERED_WRITES|NFSEXP_NOSUBTREECHECK)
36
37 int export_errno;
38
39 static char     *efname = NULL;
40 static XFILE    *efp = NULL;
41 static int      first;
42 static int      has_default_opts, has_default_subtree_opts;
43 static int      *squids = NULL, nsquids = 0,
44                 *sqgids = NULL, nsqgids = 0;
45
46 static int      getexport(char *exp, int len);
47 static int      getpath(char *path, int len);
48 static int      parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr);
49 static int      parsesquash(char *list, int **idp, int *lenp, char **ep);
50 static int      parsenum(char **cpp);
51 static void     freesquash(void);
52 static void     syntaxerr(char *msg);
53
54 void
55 setexportent(char *fname, char *type)
56 {
57         if (efp)
58                 endexportent();
59         if (!fname)
60                 fname = _PATH_EXPORTS;
61         if (!(efp = xfopen(fname, type)))
62                 xlog(L_ERROR, "can't open %s for %sing",
63                                 fname, strcmp(type, "r")? "writ" : "read");
64         efname = strdup(fname);
65         first = 1;
66 }
67
68 struct exportent *
69 getexportent(int fromkernel, int fromexports)
70 {
71         static struct exportent ee, def_ee;
72         char            exp[512], *hostname;
73         char            rpath[MAXPATHLEN+1];
74         char            *opt, *sp;
75         int             ok;
76
77         if (!efp)
78                 return NULL;
79
80         freesquash();
81
82         if (first || (ok = getexport(exp, sizeof(exp))) == 0) {
83                 has_default_opts = 0;
84                 has_default_subtree_opts = 0;
85         
86                 def_ee.e_flags = EXPORT_DEFAULT_FLAGS;
87                 /* some kernels assume the default is sync rather than
88                  * async.  More recent kernels always report one or other,
89                  * but this test makes sure we assume same as kernel
90                  * Ditto for wgather
91                  */
92                 if (fromkernel) {
93                         def_ee.e_flags &= ~NFSEXP_ASYNC;
94                         def_ee.e_flags &= ~NFSEXP_GATHERED_WRITES;
95                 }
96                 def_ee.e_anonuid = 65534;
97                 def_ee.e_anongid = 65534;
98                 def_ee.e_squids = NULL;
99                 def_ee.e_sqgids = NULL;
100                 def_ee.e_mountpoint = NULL;
101                 def_ee.e_fslocmethod = FSLOC_NONE;
102                 def_ee.e_fslocdata = NULL;
103                 def_ee.e_nsquids = 0;
104                 def_ee.e_nsqgids = 0;
105
106                 ok = getpath(def_ee.e_path, sizeof(def_ee.e_path));
107                 if (ok <= 0)
108                         return NULL;
109
110                 strncpy (def_ee.m_path, def_ee.e_path, sizeof (def_ee.m_path) - 1);
111                 def_ee.m_path [sizeof (def_ee.m_path) - 1] = '\0';
112                 ok = getexport(exp, sizeof(exp));
113         }
114         if (ok < 0) {
115                 xlog(L_ERROR, "expected client(options...)");
116                 export_errno = EINVAL;
117                 return NULL;
118         }
119         first = 0;
120                 
121         /* Check for default options */
122         if (exp[0] == '-') {
123                 if (parseopts(exp + 1, &def_ee, 0, &has_default_subtree_opts) < 0)
124                         return NULL;
125                 
126                 has_default_opts = 1;
127
128                 ok = getexport(exp, sizeof(exp));
129                 if (ok < 0) {
130                         xlog(L_ERROR, "expected client(options...)");
131                         export_errno = EINVAL;
132                         return NULL;
133                 }
134         }
135
136         ee = def_ee;
137
138         /* Check for default client */
139         if (ok == 0)
140                 exp[0] = '\0';
141
142         hostname = exp;
143         if ((opt = strchr(exp, '(')) != NULL) {
144                 if (opt == exp) {
145                         xlog(L_WARNING, "No host name given with %s %s, suggest *%s to avoid warning", ee.e_path, exp, exp);
146                         hostname = "*";
147                 }
148                 *opt++ = '\0';
149                 if (!(sp = strchr(opt, ')')) || sp[1] != '\0') {
150                         syntaxerr("bad option list");
151                         export_errno = EINVAL;
152                         return NULL;
153                 }
154                 *sp = '\0';
155         } else {
156                 if (!has_default_opts)
157                         xlog(L_WARNING, "No options for %s %s: suggest %s(sync) to avoid warning", ee.e_path, exp, exp);
158         }
159         if (strlen(hostname) >= sizeof(ee.e_hostname)) {
160                 syntaxerr("client name too long");
161                 export_errno = EINVAL;
162                 return NULL;
163         }
164         strncpy(ee.e_hostname, hostname, sizeof (ee.e_hostname) - 1);
165         ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0';
166
167         if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0)
168                 return NULL;
169
170         /* resolve symlinks */
171         if (realpath(ee.e_path, rpath) != NULL) {
172                 rpath[sizeof (rpath) - 1] = '\0';
173                 strncpy(ee.e_path, rpath, sizeof (ee.e_path) - 1);
174                 ee.e_path[sizeof (ee.e_path) - 1] = '\0';
175                 strncpy (ee.m_path, ee.e_path, sizeof (ee.m_path) - 1);
176                 ee.m_path [sizeof (ee.m_path) - 1] = '\0';
177         }
178
179         return &ee;
180 }
181
182 void
183 putexportent(struct exportent *ep)
184 {
185         FILE    *fp;
186         int     *id, i;
187         char    *esc=ep->e_path;
188
189         if (!efp)
190                 return;
191
192         fp = efp->x_fp;
193         for (i=0; esc[i]; i++)
194                 if (iscntrl(esc[i]) || esc[i] == '"' || esc[i] == '\\' || esc[i] == '#' || isspace(esc[i]))
195                         fprintf(fp, "\\%03o", esc[i]);
196                 else
197                         fprintf(fp, "%c", esc[i]);
198
199         fprintf(fp, "\t%s(", ep->e_hostname);
200         fprintf(fp, "%s,", (ep->e_flags & NFSEXP_READONLY)? "ro" : "rw");
201         fprintf(fp, "%ssync,", (ep->e_flags & NFSEXP_ASYNC)? "a" : "");
202         fprintf(fp, "%swdelay,", (ep->e_flags & NFSEXP_GATHERED_WRITES)?
203                                 "" : "no_");
204         fprintf(fp, "%shide,", (ep->e_flags & NFSEXP_NOHIDE)?
205                                 "no" : "");
206         fprintf(fp, "%scrossmnt,", (ep->e_flags & NFSEXP_CROSSMOUNT)?
207                                 "" : "no");
208         fprintf(fp, "%ssecure,", (ep->e_flags & NFSEXP_INSECURE_PORT)?
209                                 "in" : "");
210         fprintf(fp, "%sroot_squash,", (ep->e_flags & NFSEXP_ROOTSQUASH)?
211                                 "" : "no_");
212         fprintf(fp, "%sall_squash,", (ep->e_flags & NFSEXP_ALLSQUASH)?
213                                 "" : "no_");
214         fprintf(fp, "%ssubtree_check,", (ep->e_flags & NFSEXP_NOSUBTREECHECK)?
215                 "no_" : "");
216         fprintf(fp, "%ssecure_locks,", (ep->e_flags & NFSEXP_NOAUTHNLM)?
217                 "in" : "");
218         fprintf(fp, "%sacl,", (ep->e_flags & NFSEXP_NOACL)?
219                 "no_" : "");
220         if (ep->e_flags & NFSEXP_FSID) {
221                 fprintf(fp, "fsid=%d,", ep->e_fsid);
222         }
223         if (ep->e_uuid)
224                 fprintf(fp, "fsid=%s,", ep->e_uuid);
225         if (ep->e_mountpoint)
226                 fprintf(fp, "mountpoint%s%s,",
227                         ep->e_mountpoint[0]?"=":"", ep->e_mountpoint);
228         switch (ep->e_fslocmethod) {
229         case FSLOC_NONE:
230                 break;
231         case FSLOC_REFER:
232                 fprintf(fp, "refer=%s,", ep->e_fslocdata);
233                 break;
234         case FSLOC_REPLICA:
235                 fprintf(fp, "replicas=%s,", ep->e_fslocdata);
236                 break;
237 #ifdef DEBUG
238         case FSLOC_STUB:
239                 fprintf(fp, "fsloc=stub,");
240                 break;
241 #endif
242         default:
243                 xlog(L_ERROR, "unknown fsloc method for %s:%s",
244                      ep->e_hostname, ep->e_path);
245         }
246         if ((id = ep->e_squids) != NULL) {
247                 fprintf(fp, "squash_uids=");
248                 for (i = 0; i < ep->e_nsquids; i += 2)
249                         if (id[i] != id[i+1])
250                                 fprintf(fp, "%d-%d,", id[i], id[i+1]);
251                         else
252                                 fprintf(fp, "%d,", id[i]);
253         }
254         if ((id = ep->e_sqgids) != NULL) {
255                 fprintf(fp, "squash_gids=");
256                 for (i = 0; i < ep->e_nsquids; i += 2)
257                         if (id[i] != id[i+1])
258                                 fprintf(fp, "%d-%d,", id[i], id[i+1]);
259                         else
260                                 fprintf(fp, "%d,", id[i]);
261         }
262         fprintf(fp, "anonuid=%d,anongid=%d)\n", ep->e_anonuid, ep->e_anongid);
263 }
264
265 void
266 endexportent(void)
267 {
268         if (efp)
269                 xfclose(efp);
270         efp = NULL;
271         if (efname)
272                 free(efname);
273         efname = NULL;
274         freesquash();
275 }
276
277 void
278 dupexportent(struct exportent *dst, struct exportent *src)
279 {
280         int     n;
281
282         *dst = *src;
283         if ((n = src->e_nsquids) != 0) {
284                 dst->e_squids = (int *) xmalloc(n * sizeof(int));
285                 memcpy(dst->e_squids, src->e_squids, n * sizeof(int));
286         }
287         if ((n = src->e_nsqgids) != 0) {
288                 dst->e_sqgids = (int *) xmalloc(n * sizeof(int));
289                 memcpy(dst->e_sqgids, src->e_sqgids, n * sizeof(int));
290         }
291         if (src->e_mountpoint)
292                 dst->e_mountpoint = strdup(src->e_mountpoint);
293         if (src->e_fslocdata)
294                 dst->e_fslocdata = strdup(src->e_fslocdata);
295 }
296
297 struct exportent *
298 mkexportent(char *hname, char *path, char *options)
299 {
300         static struct exportent ee;
301
302         ee.e_flags = EXPORT_DEFAULT_FLAGS;
303         ee.e_anonuid = 65534;
304         ee.e_anongid = 65534;
305         ee.e_squids = NULL;
306         ee.e_sqgids = NULL;
307         ee.e_mountpoint = NULL;
308         ee.e_fslocmethod = FSLOC_NONE;
309         ee.e_fslocdata = NULL;
310         ee.e_nsquids = 0;
311         ee.e_nsqgids = 0;
312         ee.e_uuid = NULL;
313
314         if (strlen(hname) >= sizeof(ee.e_hostname)) {
315                 xlog(L_WARNING, "client name %s too long", hname);
316                 return NULL;
317         }
318         strncpy(ee.e_hostname, hname, sizeof (ee.e_hostname) - 1);
319         ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0';
320         if (strlen(path) >= sizeof(ee.e_path)) {
321                 xlog(L_WARNING, "path name %s too long", path);
322                 return NULL;
323         }
324         strncpy(ee.e_path, path, sizeof (ee.e_path));
325         ee.e_path[sizeof (ee.e_path) - 1] = '\0';
326         strncpy (ee.m_path, ee.e_path, sizeof (ee.m_path) - 1);
327         ee.m_path [sizeof (ee.m_path) - 1] = '\0';
328         if (parseopts(options, &ee, 0, NULL) < 0)
329                 return NULL;
330         return &ee;
331 }
332
333 int
334 updateexportent(struct exportent *eep, char *options)
335 {
336         if (parseopts(options, eep, 0, NULL) < 0)
337                 return 0;
338         return 1;
339 }
340
341
342 static int valid_uuid(char *uuid)
343 {
344         /* must have 32 hex digits */
345         int cnt;
346         for (cnt = 0 ; *uuid; uuid++)
347                 if (isxdigit(*uuid))
348                         cnt++;
349         return cnt == 32;
350 }
351
352 /*
353  * Parse option string pointed to by cp and set mount options accordingly.
354  */
355 static int
356 parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr)
357 {
358         int     had_subtree_opt = 0;
359         char    *flname = efname?efname:"command line";
360         int     flline = efp?efp->x_line:0;
361
362         squids = ep->e_squids; nsquids = ep->e_nsquids;
363         sqgids = ep->e_sqgids; nsqgids = ep->e_nsqgids;
364
365         if (!cp)
366                 goto out;
367
368         while (isblank(*cp))
369                 cp++;
370
371         while (*cp) {
372                 char *opt = strdup(cp);
373                 char *optstart = cp;
374                 while (*cp && *cp != ',')
375                         cp++;
376                 if (*cp) {
377                         opt[cp-optstart] = '\0';
378                         cp++;
379                 }
380
381                 /* process keyword */
382                 if (strcmp(opt, "ro") == 0)
383                         ep->e_flags |= NFSEXP_READONLY;
384                 else if (strcmp(opt, "rw") == 0)
385                         ep->e_flags &= ~NFSEXP_READONLY;
386                 else if (!strcmp(opt, "secure"))
387                         ep->e_flags &= ~NFSEXP_INSECURE_PORT;
388                 else if (!strcmp(opt, "insecure"))
389                         ep->e_flags |= NFSEXP_INSECURE_PORT;
390                 else if (!strcmp(opt, "sync"))
391                         ep->e_flags &= ~NFSEXP_ASYNC;
392                 else if (!strcmp(opt, "async"))
393                         ep->e_flags |= NFSEXP_ASYNC;
394                 else if (!strcmp(opt, "nohide"))
395                         ep->e_flags |= NFSEXP_NOHIDE;
396                 else if (!strcmp(opt, "hide"))
397                         ep->e_flags &= ~NFSEXP_NOHIDE;
398                 else if (!strcmp(opt, "crossmnt"))
399                         ep->e_flags |= NFSEXP_CROSSMOUNT;
400                 else if (!strcmp(opt, "nocrossmnt"))
401                         ep->e_flags &= ~NFSEXP_CROSSMOUNT;
402                 else if (!strcmp(opt, "wdelay"))
403                         ep->e_flags |= NFSEXP_GATHERED_WRITES;
404                 else if (!strcmp(opt, "no_wdelay"))
405                         ep->e_flags &= ~NFSEXP_GATHERED_WRITES;
406                 else if (strcmp(opt, "root_squash") == 0)
407                         ep->e_flags |= NFSEXP_ROOTSQUASH;
408                 else if (!strcmp(opt, "no_root_squash"))
409                         ep->e_flags &= ~NFSEXP_ROOTSQUASH;
410                 else if (strcmp(opt, "all_squash") == 0)
411                         ep->e_flags |= NFSEXP_ALLSQUASH;
412                 else if (strcmp(opt, "no_all_squash") == 0)
413                         ep->e_flags &= ~NFSEXP_ALLSQUASH;
414                 else if (strcmp(opt, "subtree_check") == 0) {
415                         had_subtree_opt = 1;
416                         ep->e_flags &= ~NFSEXP_NOSUBTREECHECK;
417                 } else if (strcmp(opt, "no_subtree_check") == 0) {
418                         had_subtree_opt = 1;
419                         ep->e_flags |= NFSEXP_NOSUBTREECHECK;
420                 } else if (strcmp(opt, "auth_nlm") == 0)
421                         ep->e_flags &= ~NFSEXP_NOAUTHNLM;
422                 else if (strcmp(opt, "no_auth_nlm") == 0)
423                         ep->e_flags |= NFSEXP_NOAUTHNLM;
424                 else if (strcmp(opt, "secure_locks") == 0)
425                         ep->e_flags &= ~NFSEXP_NOAUTHNLM;
426                 else if (strcmp(opt, "insecure_locks") == 0)
427                         ep->e_flags |= NFSEXP_NOAUTHNLM;
428                 else if (strcmp(opt, "acl") == 0)
429                         ep->e_flags &= ~NFSEXP_NOACL;
430                 else if (strcmp(opt, "no_acl") == 0)
431                         ep->e_flags |= NFSEXP_NOACL;
432                 else if (strncmp(opt, "anonuid=", 8) == 0) {
433                         char *oe;
434                         ep->e_anonuid = strtol(opt+8, &oe, 10);
435                         if (opt[8]=='\0' || *oe != '\0') {
436                                 xlog(L_ERROR, "%s: %d: bad anonuid \"%s\"\n",
437                                      flname, flline, opt);      
438 bad_option:
439                                 free(opt);
440                                 export_errno = EINVAL;
441                                 return -1;
442                         }
443                 } else if (strncmp(opt, "anongid=", 8) == 0) {
444                         char *oe;
445                         ep->e_anongid = strtol(opt+8, &oe, 10);
446                         if (opt[8]=='\0' || *oe != '\0') {
447                                 xlog(L_ERROR, "%s: %d: bad anongid \"%s\"\n",
448                                      flname, flline, opt);      
449                                 goto bad_option;
450                         }
451                 } else if (strncmp(opt, "squash_uids=", 12) == 0) {
452                         if (parsesquash(opt+12, &squids, &nsquids, &cp) < 0) {
453                                 goto bad_option;
454                         }
455                 } else if (strncmp(opt, "squash_gids=", 12) == 0) {
456                         if (parsesquash(opt+12, &sqgids, &nsqgids, &cp) < 0) {
457                                 goto bad_option;
458                         }
459                 } else if (strncmp(opt, "fsid=", 5) == 0) {
460                         char *oe;
461                         if (strcmp(opt+5, "root") == 0) {
462                                 ep->e_fsid = 0;
463                                 ep->e_flags |= NFSEXP_FSID;
464                         } else {
465                                 ep->e_fsid = strtoul(opt+5, &oe, 0);
466                                 if (opt[5]!='\0' && *oe == '\0') 
467                                         ep->e_flags |= NFSEXP_FSID;
468                                 else if (valid_uuid(opt+5))
469                                         ep->e_uuid = strdup(opt+7);
470                                 else {
471                                         xlog(L_ERROR, "%s: %d: bad fsid \"%s\"\n",
472                                              flname, flline, opt);      
473                                         goto bad_option;
474                                 }
475                         }
476                 } else if (strcmp(opt, "mountpoint")==0 ||
477                            strcmp(opt, "mp") == 0 ||
478                            strncmp(opt, "mountpoint=", 11)==0 ||
479                            strncmp(opt, "mp=", 3) == 0) {
480                         char * mp = strchr(opt, '=');
481                         if (mp)
482                                 ep->e_mountpoint = strdup(mp+1);
483                         else
484                                 ep->e_mountpoint = strdup("");
485 #ifdef DEBUG
486                 } else if (strncmp(opt, "fsloc=", 6) == 0) {
487                         if (strcmp(opt+6, "stub") == 0)
488                                 ep->e_fslocmethod = FSLOC_STUB;
489                         else {
490                                 xlog(L_ERROR, "%s:%d: bad option %s\n",
491                                      flname, flline, opt);
492                                 goto bad_option;
493                         }
494 #endif
495                 } else if (strncmp(opt, "refer=", 6) == 0) {
496                         ep->e_fslocmethod = FSLOC_REFER;
497                         ep->e_fslocdata = strdup(opt+6);
498                 } else if (strncmp(opt, "replicas=", 9) == 0) {
499                         ep->e_fslocmethod = FSLOC_REPLICA;
500                         ep->e_fslocdata = strdup(opt+9);
501                 } else {
502                         xlog(L_ERROR, "%s:%d: unknown keyword \"%s\"\n",
503                                         flname, flline, opt);
504                         ep->e_flags |= NFSEXP_ALLSQUASH | NFSEXP_READONLY;
505                         goto bad_option;
506                 }
507                 free(opt);
508                 while (isblank(*cp))
509                         cp++;
510         }
511
512         ep->e_squids = squids;
513         ep->e_sqgids = sqgids;
514         ep->e_nsquids = nsquids;
515         ep->e_nsqgids = nsqgids;
516
517 out:
518         if (warn && !had_subtree_opt)
519                 xlog(L_WARNING, "%s [%d]: Neither 'subtree_check' or 'no_subtree_check' specified for export \"%s:%s\".\n"
520                                 "  Assuming default behaviour ('no_subtree_check').\n"
521                                 "  NOTE: this default has changed since nfs-utils version 1.0.x\n",
522
523                                 flname, flline,
524                                 ep->e_hostname, ep->e_path);
525         if (had_subtree_opt_ptr)
526                 *had_subtree_opt_ptr = had_subtree_opt;
527
528         return 1;
529 }
530
531 static int
532 parsesquash(char *list, int **idp, int *lenp, char **ep)
533 {
534         char    *cp = list;
535         int     id0, id1;
536         int     len = *lenp;
537         int     *id = *idp;
538
539         if (**ep)
540             *--(*ep) = ',';
541
542         do {
543                 id0 = parsenum(&cp);
544                 if (*cp == '-') {
545                         cp++;
546                         id1 = parsenum(&cp);
547                 } else {
548                         id1 = id0;
549                 }
550                 if (id0 == -1 || id1 == -1) {
551                         syntaxerr("uid/gid -1 not permitted");
552                         return -1;
553                 }
554                 if ((len % 8) == 0)
555                         id = (int *) xrealloc(id, (len + 8) * sizeof(*id));
556                 id[len++] = id0;
557                 id[len++] = id1;
558                 if (!*cp || *cp == ')' || (*cp == ',' && !isdigit(cp[1])))
559                         break;
560                 if (*cp != ',') {
561                         syntaxerr("bad uid/gid list");
562                         return -1;
563                 }
564                 cp++;
565         } while(1);
566
567         if (**ep == ',') (*ep)++;
568
569         *lenp = len;
570         *idp = id;
571         return 1;
572 }
573
574 static void
575 freesquash(void)
576 {
577         if (squids) {
578                 xfree (squids);
579                 squids = NULL;
580                 nsquids = 0;
581         }
582         if (sqgids) {
583                 xfree (sqgids);
584                 sqgids = NULL;
585                 nsqgids = 0;
586         }
587 }
588
589 static int
590 parsenum(char **cpp)
591 {
592         char    *cp = *cpp, c;
593         int     num = 0;
594
595         if (**cpp == '-')
596                 (*cpp)++;
597         while (isdigit(**cpp))
598                 (*cpp)++;
599         c = **cpp; **cpp = '\0'; num = atoi(cp); **cpp = c;
600         return num;
601 }
602
603 static int
604 getpath(char *path, int len)
605 {
606         xskip(efp, " \t\n");
607         return xgettok(efp, 0, path, len);
608 }
609
610 static int
611 getexport(char *exp, int len)
612 {
613         int     ok;
614
615         xskip(efp, " \t");
616         if ((ok = xgettok(efp, 0, exp, len)) < 0)
617                 xlog(L_ERROR, "%s:%d: syntax error",
618                         efname?"command line":efname, efp->x_line);
619         return ok;
620 }
621
622 static void
623 syntaxerr(char *msg)
624 {
625         xlog(L_ERROR, "%s:%d: syntax error: %s",
626                         efname, efp?efp->x_line:0, msg);
627 }
628