X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=authbind.git;a=blobdiff_plain;f=helper.c;h=5bd95fd24dbc8ed66d6826508cf02ed4f9f45a3d;hp=e086e9e23808f9fa6c84d6d5ff822230e3ebf78e;hb=3f781654282c8c85317394dfd874483c4321fac1;hpb=8ddfdffdd892f3ab3fb42c10ff5abd6653f7c166 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 - * 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/ with access(2,X_OK). - * If OK, then authorised. - * If ENOENT then keep looking. - * Otherwise, not authorised, errno=whatever - * - * Then check /etc/authbind/byboth/: likewise. - * - * Then try to read /etc/authbind/byuid/ (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 - * /:, - * then authorised, otherwise not authorised, errno=ENOENT - * If read error then is an error - * - * In each case, - * is dotted quad - * is decimal in host order - * is prefix length (so 0.0.0.0/32 matches any) - * 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 @@ -39,7 +30,11 @@ #include #include -#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); }