/* -*-c-*-
*
- * $Id: bcquery.c,v 1.2 1998/06/26 10:32:31 mdw Exp $
+ * $Id: bcquery.c,v 1.4 2003/10/12 00:14:55 mdw Exp $
*
* Query and dump Become's configuration file
*
/*----- Revision history --------------------------------------------------*
*
* $Log: bcquery.c,v $
- * Revision 1.2 1998/06/26 10:32:31 mdw
+ * Revision 1.4 2003/10/12 00:14:55 mdw
+ * Major overhaul. Now uses DSA signatures rather than the bogus symmetric
+ * encrypt-and-hope thing. Integrated with mLib and Catacomb.
+ *
+ * Revision 1.3 1999/05/04 16:17:11 mdw
+ * Change to header file name for parser. See log for `parse.h' for
+ * details.
+ *
+ * Revision 1.2 1998/06/26 10:32:31 mdw
* Cosmetic change: use sizeof(destination) in memcpy.
*
* Revision 1.1 1998/04/23 13:20:20 mdw
#include <syslog.h>
#include <unistd.h>
+/* --- mLib headers --- */
+
+#include <mLib/alloc.h>
+#include <mLib/mdwopt.h>
+#include <mLib/quis.h>
+#include <mLib/report.h>
+#include <mLib/sym.h>
+
/* --- Local headers --- */
#include "become.h"
#include "config.h"
#include "daemon.h"
#include "lexer.h"
-#include "mdwopt.h"
#include "name.h"
#include "netg.h"
-#include "parser.h"
+#include "parse.h"
#include "rule.h"
-#include "sym.h"
-#include "utils.h"
#include "userdb.h"
/*----- Type definitions --------------------------------------------------*/
bit = cat_what;
goto setbits;
default:
- die("unknown column specifier `%c'", *p);
+ die(1, "unknown column specifier `%c'", *p);
break;
setbits:
if (mode == m_replace) {
else if (mode == m_remove)
outmask &= ~bit;
else
- die("bad mode while setting output mask: %u", mode);
+ die(1, "bad mode while setting output mask: %u", mode);
break;
}
p++;
goto again;
}
case '?':
- die("type `%s --help' for usage information", quis());
+ die(1, "type `%s --help' for usage information", quis());
case 0:
if (optarg[0] && optarg[1] == 0) switch (optarg[0]) {
case '(': case ')':
break;
}
if (!opt)
- die("unexpected text `%s' found", optarg);
+ die(1, "unexpected text `%s' found", optarg);
break;
}
nextopt();
q = qparse_expr();
if (opt != ')')
- die("syntax error: expected `)', found `%s'", optname());
+ die(1, "syntax error: expected `)', found `%s'", optname());
nextopt();
return (q);
}
qnode *q = xmalloc(sizeof(*q));
h = gethostbyname(optarg);
if (!h)
- die("unknown host `%s'", optarg);
+ die(1, "unknown host `%s'", optarg);
q->q_cat = cat_where;
memcpy(&q->q_in, h->h_addr, sizeof(q->q_in));
nextopt();
}
pw = userdb_userByName(optarg);
if (!pw)
- die("unknown user `%s'", optarg);
+ die(1, "unknown user `%s'", optarg);
q->q_uid = pw->pw_uid;
}
nextopt();
return (q);
}
default:
- die("unexpected token: `%s'", optname());
+ die(1, "unexpected token: `%s'", optname());
}
return (0);
}
return (0);
q = qparse_expr();
if (opt != EOF)
- die("syntax error: `%s' unexpected", optname());
+ die(1, "syntax error: `%s' unexpected", optname());
return (q);
}
/* --- Anything else is bogus (and a bug) --- */
- die("unexpected cat code %u in checkrule", q->q_cat);
+ die(1, "unexpected cat code %u in checkrule", q->q_cat);
return (-1);
}
break;
case clNode_hash: {
sym_base *b;
- sym_createIter(i, &c->v.t);
+ sym_mkiter(i, &c->v.t);
b = sym_next(i);
if (!b) {
printf(fmt, "");
case clNode_hash: {
sym_iter i;
sym_base *b;
- sym_createIter(&i, &c->v.t);
+ sym_mkiter(&i, &c->v.t);
fputc('(', stdout);
if ((b = sym_next(&i)) != 0) {
sh(b);
int ok;
if (!fp)
- die("couldn't open configuration file `%s': %s", cf, strerror(errno));
+ die(1, "couldn't open configuration file `%s': %s", cf, strerror(errno));
lexer_scan(fp);
ok = parse();
if (flags & f_check)
/* --- Done --- */
if (!(flags & f_match))
- die("no match");
+ die(1, "no match");
return (0);
}