summaryrefslogtreecommitdiff
path: root/helper.c
diff options
context:
space:
mode:
authorian <ian>1998-08-30 02:35:14 +0000
committerian <ian>1998-08-30 02:35:14 +0000
commit3f781654282c8c85317394dfd874483c4321fac1 (patch)
tree0a4618ba180f059d6b5a919a48818b0f98e8ce9d /helper.c
parent8ddfdffdd892f3ab3fb42c10ff5abd6653f7c166 (diff)
Much new build world.
Diffstat (limited to 'helper.c')
-rw-r--r--helper.c51
1 files changed, 23 insertions, 28 deletions
diff --git a/helper.c b/helper.c
index e086e9e..5bd95fd 100644
--- a/helper.c
+++ b/helper.c
@@ -1,31 +1,22 @@
/*
- * setuid. Invoked with socket on stdin.
- * Usage: helper <addr> <port>
- * both are hex strings, padded to the right length.
- * they are pairs of hex digits for each byte (network byte order)
+ * helper.c - setuid helper program for authbind
*
- * If /etc/authbind cannot be chdir'd into, is an error.
- *
- * First, check /etc/authbind/byport/<port> with access(2,X_OK).
- * If OK, then authorised.
- * If ENOENT then keep looking.
- * Otherwise, not authorised, errno=whatever
- *
- * Then check /etc/authbind/byboth/<addr>:<port> likewise.
- *
- * Then try to read /etc/authbind/byuid/<uid> (with superuser privs!)
- * If ENOENT, then not authorised, errno=EPERM
- * If cannot open, then not authorised, errno=whatever
- * If it contains a line of the form
- * <addr>/<length>:<port-min>,<port-max>
- * then authorised, otherwise not authorised, errno=ENOENT
- * If read error then is an error
- *
- * In each case,
- * <addr> is dotted quad
- * <port> is decimal in host order
- * <length> is prefix length (so 0.0.0.0/32 matches any)
- * <uid> is decimal unsigned
+ * authbind is Copyright (C) 1998 Ian Jackson
+ *
+ * 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 2, or (at your option)
+ * any later version.
+ *
+ * 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 <errno.h>
@@ -39,7 +30,11 @@
#include <netinet/in.h>
#include <arpa/inet.h>
-#define CONFIGDIR "/etc/authbind"
+#ifndef CONFIGDIR
+# define CONFIGDIR "/etc/authbind"
+#endif
+
+static const char *rcsid="$Id$";
static void exiterrno(int e) {
exit(e>0 && e<128 ? e : ENOSYS);
@@ -53,7 +48,7 @@ static void perrorfail(const char *m) {
}
static void badusage(void) {
- fputs("libauthbind's helper: bad usage\n",stderr);
+ fprintf(stderr,"libauthbind's helper: bad usage\n %s\n",rcsid);
exit(ENOSYS);
}