diff options
author | Hans Insulander <hin@cvs.openbsd.org> | 2002-06-07 04:44:14 +0000 |
---|---|---|
committer | Hans Insulander <hin@cvs.openbsd.org> | 2002-06-07 04:44:14 +0000 |
commit | 99d35653eff8a7e21ef510f75fdd914b6a04bb2b (patch) | |
tree | 854e62a0f9440093b450f27fc83489777bddc3de /usr.sbin | |
parent | 8e2018a6fd860d43426f03bb5960ea84cf3de007 (diff) |
merge
Diffstat (limited to 'usr.sbin')
127 files changed, 2637 insertions, 1780 deletions
diff --git a/usr.sbin/afs/src/milko/ChangeLog b/usr.sbin/afs/src/milko/ChangeLog index 2966ce549db..cb8cdb33ff7 100644 --- a/usr.sbin/afs/src/milko/ChangeLog +++ b/usr.sbin/afs/src/milko/ChangeLog @@ -1,3 +1,117 @@ +2001-01-01 Love <lha@stacken.kth.se> + + * fs/fsprocs.c: (RXAFS_FetchACL): add dummy call to i2nlist() to + return numbers when pts-server is down + (RXAFS_Link): dummy implement, not enabled + + * vldb/vldbserver.c(main): pass realm to network_init(). + +2000-12-29 Tomas Olsson <tol@stacken.kth.se> + + * appl/sked/sked.c ({vol{create,show,ls},salvage}_cmd): + Handle vicep* in other places than / + * lib/voldb/voldb_locl.h Makefile.in vol.c: + Handle vicep* in other places than / + * lib/dpart/dpart.[ch]: Handle vicep* in other places than / + * fs/fileserver.c (main): use the given realm, new arg partdir, + place to look for vicep* + (sigusr1): look in the right place for vicepa + * pts/ptserver.c (main): use the given realm + * fs/fsprocs.c (RXAFS_StoreACL): return correct values + * lib/vld/vld.c (vld_create_volume): no default rights for + anonymous + +2000-12-10 Love <lha@stacken.kth.se> + + * appl/perf/perf.c: return somewhat more sane error-codes in the + callbackserver + +2000-12-05 Love <lha@stacken.kth.se> + + * lib/mlog/Makefile.in: added $(srcdir)/../../.. + +2000-12-04 Love <lha@stacken.kth.se> + + * lib/ropa/ropa.c (ropa_getcallback): if we fail to probe the + client, whine and return a bogus callback + (update_callback_time): new, update a backback + (update_callback): use update_callback_time(). + +2000-12-01 Tomas Olsson <tol@stacken.kth.se> + + * fs/fsprocs.c (*): always give a real mnode as arg when calling + vld_modify_vnode() + * lib/vld/vld.c (*ent_to_fetchstatus): new format w/ volume_handle + (*): set fetchstatus more correctly, use new *ent_to_fetchstatus + +2000-11-25 Love <lha@stacken.kth.se> + + * lib/ropa/ropa.c: first shot at threadsafeness + +2000-10-08 Tomas Olsson <tol@stacken.kth.se> + + * appl/sked/sked.c (volcreate_cmd): parse partition name correctly + +2000-10-03 Love <lha@stacken.kth.se> + + * **/*.[chly]: Removed advertising clause. + +2000-10-02 Assar Westerlund <assar@sics.se> + + * lib/vld/vld.c (vld_check_rights): always look at the node itself + if it's a directory + * lib/vld/mnode.h: remove VOLOP_PARENT + +2000-09-29 Tomas Olsson <tol@stacken.kth.se> + + * pts/ptserver.c (addtogroup): avoid duplicates + * bos/bosserver.c: check both serverfile and bos.conf + * appl/sked/sked.c (main): make logging work + * fs/fsprocs.c + (RXAFS_{FetchData,FetchStatus,StoreData,CreateFile}): log + calleraccess on return + * fs/fileserver.c (main): use ropa_init() the new way + * lib/ropa/ropa.h: update prototype for ropa_init() + * lib/ropa/ropa.c: keep connections to clients and reuse, + added hashtable to keep track of ccpairs + (ropa_init): new interface w/ htabsizes & #ccpairs + +2000-09-29 Love <lha@stacken.kth.se> + + * pts/pr.c (PR_NameToID,PR_IDToName): print [in]len + * pts/*.c: change to log_log, clean up + * bos/bosserver.c: remove unused variables + +2000-09-15 Mattias Amnefelt <mattiasa@e.kth.se> + + * pts/ptserver.c (find_first_free): Use deleted entries + * pts/ptserver.c (listelements): don't include own id when + PR_ListElements + +2000-09-15 Tomas Olsson <tol@stacken.kth.se> + + * lib/mlog/mlog.c (mlog_loginit): use the supplied method + +2000-09-06 Tomas Olsson <tol@stacken.kth.se> + + * fs/fsprocs.c (removenode): return error if dirp doesn't match + actual node type + * bos/bosserver.c: somewhat closer to working condition + * bos.conf: closer to current format + +2000-09-04 Love <lha@stacken.kth.se> + + * pts/ptserver.c: remove some warnings usr log_log + +2000-09-03 Love <lha@stacken.kth.se> + + * bos/bosprocs.c (AddSUser, DeleteSUser): add some content + (*): re-indent + +2000-09-02 Love <lha@stacken.kth.se> + + * bos/bosprocs.c: added missing functions + 2000-08-24 Love <lha@stacken.kth.se> * fs/fileserver.c: update code to new mlog_log_set_level @@ -36,7 +150,7 @@ * lib/vld/vld.h: more unsigned * lib/vld/mnode.h: use unsigned instead of long for flags * lib/ropa/ropa.c (find_client): fix typo - (client_update_interfaces): use htohl() on hidden elements in + (client_update_interfaces): use ntohl() on hidden elements in struct from peer (ropa_init): get & save debuglevel for later use (debug_print_callbacks): don't iterate if MDEBROPA not set i debuglevel diff --git a/usr.sbin/afs/src/milko/Makefile.in b/usr.sbin/afs/src/milko/Makefile.in index 8cea6db9543..34918ddba61 100644 --- a/usr.sbin/afs/src/milko/Makefile.in +++ b/usr.sbin/afs/src/milko/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:11 art Exp $ +# $KTH: Makefile.in,v 1.49 2000/10/08 06:22:04 lha Exp $ srcdir = @srcdir@ +top_builddir = .. VPATH = @srcdir@ SHELL = /bin/sh diff --git a/usr.sbin/afs/src/milko/README b/usr.sbin/afs/src/milko/README index 3c74d35634a..98c2dfff35d 100644 --- a/usr.sbin/afs/src/milko/README +++ b/usr.sbin/afs/src/milko/README @@ -1,4 +1,4 @@ - Milko ($Id: README,v 1.1 2000/09/11 14:41:11 art Exp $) + Milko ($KTH: README,v 1.28 2000/08/16 22:17:48 tol Exp $) ===== Note: diff --git a/usr.sbin/afs/src/milko/appl/Makefile.in b/usr.sbin/afs/src/milko/appl/Makefile.in index c979d008b34..b6011b9bfb1 100644 --- a/usr.sbin/afs/src/milko/appl/Makefile.in +++ b/usr.sbin/afs/src/milko/appl/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:11 art Exp $ +# $KTH: Makefile.in,v 1.4 2000/10/08 06:22:11 lha Exp $ srcdir = @srcdir@ +top_builddir = ../.. VPATH = @srcdir@ SHELL = /bin/sh diff --git a/usr.sbin/afs/src/milko/appl/bootstrap/Makefile.in b/usr.sbin/afs/src/milko/appl/bootstrap/Makefile.in index 7ffff3bf53d..565f43fcd91 100644 --- a/usr.sbin/afs/src/milko/appl/bootstrap/Makefile.in +++ b/usr.sbin/afs/src/milko/appl/bootstrap/Makefile.in @@ -1,8 +1,9 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:11 art Exp $ +# $KTH: Makefile.in,v 1.2 2000/10/08 06:22:18 lha Exp $ SHELL = /bin/sh srcdir = @srcdir@ +top_builddir = ../../.. VPATH = @srcdir@ CC = @CC@ diff --git a/usr.sbin/afs/src/milko/appl/bootstrap/anti-boot-strap.sh.in b/usr.sbin/afs/src/milko/appl/bootstrap/anti-boot-strap.sh.in index 6428987dc7c..231598330dd 100644 --- a/usr.sbin/afs/src/milko/appl/bootstrap/anti-boot-strap.sh.in +++ b/usr.sbin/afs/src/milko/appl/bootstrap/anti-boot-strap.sh.in @@ -5,7 +5,7 @@ # shell stuff -version="$Id: anti-boot-strap.sh.in,v 1.1 2000/09/11 14:41:11 art Exp $" +version="$KTH: anti-boot-strap.sh.in,v 1.2 1999/11/03 05:57:53 lha Exp $" usage="NOT USE IF YOU DONT KNOW _=*KNOW*=_ WHAT YOU ARE DOING" PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH diff --git a/usr.sbin/afs/src/milko/appl/bootstrap/boot-strap.sh.in b/usr.sbin/afs/src/milko/appl/bootstrap/boot-strap.sh.in index 6a878ea7cc7..b1862ae612c 100644 --- a/usr.sbin/afs/src/milko/appl/bootstrap/boot-strap.sh.in +++ b/usr.sbin/afs/src/milko/appl/bootstrap/boot-strap.sh.in @@ -5,7 +5,7 @@ # shell stuff -version="$Id: boot-strap.sh.in,v 1.1 2000/09/11 14:41:11 art Exp $" +version="$KTH: boot-strap.sh.in,v 1.4 2000/02/19 07:13:02 lha Exp $" usage="Usage: $0 [-v] [-p /viceN ]" # diff --git a/usr.sbin/afs/src/milko/appl/perf/Makefile.in b/usr.sbin/afs/src/milko/appl/perf/Makefile.in index 38fe26eae41..071f4b4b6ca 100644 --- a/usr.sbin/afs/src/milko/appl/perf/Makefile.in +++ b/usr.sbin/afs/src/milko/appl/perf/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:11 art Exp $ +# $KTH: Makefile.in,v 1.4 2000/10/10 20:56:17 lha Exp $ srcdir = @srcdir@ +top_builddir = ../../.. VPATH = @srcdir@ CC = @CC@ @@ -38,6 +39,7 @@ INCLUDES = -I$(srcdir)/../../fs \ -I../../../include \ -I../../../rxdef \ @KRB4_INC_FLAGS@ \ + @INC_roken@ \ -I. DEFINES = @@ -52,14 +54,13 @@ LIBS = -L../../../lib/sl -lsl \ -L../../../appl/lib -larlalib \ -L../../../lib/ko -lko \ -L../../../rxdef -lrxdefclient \ - -L../../../lib/roken \ @MILKO_RXKAD_LIBS2@ \ @KRB4_LIB_FLAGS@ \ -L../../../util -lutil \ - -lroken @LIBS@ + @LIB_roken@ \ + @LIBS@ -LIBDEPENDS = ../../../util/libutil.a ../../../lib/sl/libsl.a \ - ../../../lib/roken/libroken.a +LIBDEPENDS = ../../../util/libutil.a ../../../lib/sl/libsl.a PERF_SRCS = perf.c SRCS = $(PERF_SRCS) diff --git a/usr.sbin/afs/src/milko/appl/perf/perf.c b/usr.sbin/afs/src/milko/appl/perf/perf.c index 8a59cc376ce..c9abd1b024e 100644 --- a/usr.sbin/afs/src/milko/appl/perf/perf.c +++ b/usr.sbin/afs/src/milko/appl/perf/perf.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -40,7 +35,7 @@ #include <config.h> #endif -RCSID("$Id: perf.c,v 1.1 2000/09/11 14:41:12 art Exp $"); +RCSID("$KTH: perf.c,v 1.12 2000/12/10 22:24:37 lha Exp $"); #include <sys/types.h> #include <stdio.h> @@ -57,6 +52,7 @@ RCSID("$Id: perf.c,v 1.1 2000/09/11 14:41:12 art Exp $"); #include <rx/rx.h> #include <rx/rx_null.h> +#include <rx/rxgencon.h> #include <rxkad/rxkad.h> #include <atypes.h> @@ -65,7 +61,7 @@ RCSID("$Id: perf.c,v 1.1 2000/09/11 14:41:12 art Exp $"); #include <ports.h> #include <service.h> -#include <getarg.h> +#include <agetarg.h> static char *arg_cell = NULL; @@ -114,7 +110,7 @@ int RXAFSCB_XStatsVersion(struct rx_call *a_rxCallP, int32_t *version) { - return EOPNOTSUPP; + return RXGEN_OPCODE; } int @@ -125,35 +121,35 @@ RXAFSCB_GetXStats(struct rx_call *a_rxCallP, int32_t *time, AFSCB_CollData *stats) { - return EOPNOTSUPP; + return RXGEN_OPCODE; } int RXAFSCB_InitCallBackState2(struct rx_call *a_rxCallP, interfaceAddr *addr) { - return EOPNOTSUPP; + return RXGEN_OPCODE; } int RXAFSCB_WhoAreYou(struct rx_call *a_rxCallP, interfaceAddr *addr) { - return EOPNOTSUPP; + return RXGEN_OPCODE; } int RXAFSCB_InitCallBackState3(struct rx_call *a_rxCallP, const afsUUID *server_uuid) { - return EOPNOTSUPP; + return 0; } int RXAFSCB_ProbeUUID(struct rx_call *a_rxCallP, const afsUUID *uuid) { - return EOPNOTSUPP; + return RXGEN_OPCODE; } static void @@ -591,28 +587,28 @@ static int arg_help = 0; static int arg_vnode = 0; static int arg_uniq = 0; -struct getargs args[] = { - {"host", 0, arg_string, &arg_host, - "what host to use", "host", arg_mandatory}, - {"volume", 0, arg_integer, &arg_volume, - "what volume to use", NULL, arg_mandatory}, - {"authlevel",0, arg_integer, &arg_authlevel, - "authlevel", NULL, arg_mandatory}, - {"help", 0, arg_flag, &arg_help, - "authlevel", NULL, arg_mandatory}, - {"vnode", 0, arg_integer, &arg_vnode, - "what vnode to read from", NULL, arg_optional}, - {"uniq", 0, arg_integer, &arg_uniq, - "what uniq to read from", NULL, arg_optional}, - {"cell", 0, arg_string, &arg_cell, - "cell", NULL, arg_optional}, +struct agetargs args[] = { + {"host", 0, aarg_string, &arg_host, + "what host to use", "host", aarg_mandatory}, + {"volume", 0, aarg_integer, &arg_volume, + "what volume to use", NULL, aarg_mandatory}, + {"authlevel",0, aarg_integer, &arg_authlevel, + "authlevel", NULL, aarg_mandatory}, + {"help", 0, aarg_flag, &arg_help, + "authlevel", NULL, aarg_mandatory}, + {"vnode", 0, aarg_integer, &arg_vnode, + "what vnode to read from", NULL, aarg_optional}, + {"uniq", 0, aarg_integer, &arg_uniq, + "what uniq to read from", NULL, aarg_optional}, + {"cell", 0, aarg_string, &arg_cell, + "cell", NULL, aarg_optional}, { NULL, 0} }; static void usage (int eval) { - arg_printusage(args, "perf", NULL, ARG_AFSSTYLE); + aarg_printusage(args, "perf", NULL, AARG_AFSSTYLE); printf ("\nTips:\n" " on errors use `fs strerror <errno>' to figure" @@ -635,8 +631,8 @@ main (int argc, char **argv) if (ret) errx (1, "rx_Init returnd %d", ret); - if (getarg (args, argc, argv, &optind, ARG_AFSSTYLE)) { - arg_printusage (args, "", NULL, ARG_AFSSTYLE); + if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) { + aarg_printusage (args, "", NULL, AARG_AFSSTYLE); return 0; } diff --git a/usr.sbin/afs/src/milko/appl/sked/Makefile.in b/usr.sbin/afs/src/milko/appl/sked/Makefile.in index 0e2267fbe9c..61038744591 100644 --- a/usr.sbin/afs/src/milko/appl/sked/Makefile.in +++ b/usr.sbin/afs/src/milko/appl/sked/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:12 art Exp $ +# $KTH: Makefile.in,v 1.14 2000/10/08 06:22:31 lha Exp $ srcdir = @srcdir@ +top_builddir = ../../.. VPATH = @srcdir@ CC = @CC@ diff --git a/usr.sbin/afs/src/milko/appl/sked/sked.c b/usr.sbin/afs/src/milko/appl/sked/sked.c index df4a10aa90c..3a56605d316 100644 --- a/usr.sbin/afs/src/milko/appl/sked/sked.c +++ b/usr.sbin/afs/src/milko/appl/sked/sked.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -39,7 +34,7 @@ #include <config.h> #include "roken.h" -RCSID("$Id: sked.c,v 1.1 2000/09/11 14:41:12 art Exp $"); +RCSID("$KTH: sked.c,v 1.26 2000/12/29 20:21:30 tol Exp $"); #include <stdio.h> #include <sys/types.h> @@ -51,7 +46,7 @@ RCSID("$Id: sked.c,v 1.1 2000/09/11 14:41:12 art Exp $"); #include <assert.h> #include <sl.h> -#include <getarg.h> +#include <agetarg.h> #include <atypes.h> #include <rx/rx.h> @@ -224,13 +219,19 @@ volcreate_cmd (int argc, char **argv) u_int32_t num, part; int ret; - if (argc != 4) { - printf ("usage: volcreate part num name\n"); + if (argc < 4 || argc > 5) { + printf ("usage: volcreate part num name [partdir]\n"); INTER_RETURN(1); } - part = atoi (argv[1]); - + dpart_root = argv[4]; + + ret = dp_parse (argv[1], &part); + if (ret) { + printf ("volcreate: `%s' is a invalid argument for partition\n", argv[1]); + INTER_RETURN(1); + } + num = atoi (argv[2]); if (num == 0) { printf ("volcreate: `%s' is a invalid argument for volnum\n", argv[2]); @@ -258,8 +259,8 @@ volshow_cmd (int argc, char **argv) u_int32_t num, part; int ret; - if (argc != 3) { - printf ("usage: volshow part num\n"); + if (argc < 3 || argc > 4) { + printf ("usage: volshow part num [partdir]\n"); INTER_RETURN(1); } @@ -271,6 +272,8 @@ volshow_cmd (int argc, char **argv) INTER_RETURN(1); } + dpart_root = argv[4]; + ret = show_volume (part, num); if (ret) { printf ("volshow: show_volume returned: %d\n", ret); @@ -329,8 +332,8 @@ volls_cmd (int argc, char **argv) struct dp_part *dp; int ret; - if (argc != 4) { - printf ("volls part volume# vnode#\n"); + if (argc < 4 || argc > 5) { + printf ("volls part volume# vnode# [partdir]\n"); INTER_RETURN(1); } @@ -347,6 +350,8 @@ volls_cmd (int argc, char **argv) INTER_RETURN(1); } + dpart_root = argv[4]; + ret = dp_create (part, &dp); if (ret) { printf ("volls: dp_create: %d\n", ret); @@ -423,14 +428,14 @@ volvnode_cmd (int argc, char **argv) int do_list = 0; int ret, optind = 0; - struct getargs args[] = { - {"part", 0, arg_string, NULL, - "what part to use", NULL, arg_mandatory}, - {"vol", 0, arg_string, NULL, - "what vol to use", NULL, arg_mandatory}, - {"list", 'l', arg_flag, NULL, + struct agetargs args[] = { + {"part", 0, aarg_string, NULL, + "what part to use", NULL, aarg_mandatory}, + {"vol", 0, aarg_string, NULL, + "what vol to use", NULL, aarg_mandatory}, + {"list", 'l', aarg_flag, NULL, "list vnodes" }, - { NULL, 0, arg_end, NULL } + { NULL, 0, aarg_end, NULL } }, *arg; arg = args; @@ -438,8 +443,8 @@ volvnode_cmd (int argc, char **argv) arg->value = &vol_str; arg++; arg->value = &do_list; arg++; - if (getarg (args, argc, argv, &optind, ARG_AFSSTYLE)) { - arg_printusage(args, "volvnode", NULL, ARG_AFSSTYLE); + if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) { + aarg_printusage(args, "volvnode", NULL, AARG_AFSSTYLE); INTER_RETURN(1); } part = atoi(part_str); @@ -555,14 +560,14 @@ fvolcreate_cmd (int argc, char **argv) struct dp_part *dp; int ret, optind = 0; - struct getargs args[] = { - {"part", 0, arg_string, NULL, - "what part to use", NULL, arg_mandatory}, - {"vol", 0, arg_integer, NULL, - "what vol-number to use", NULL, arg_mandatory}, - {"path", 0, arg_string, NULL, - "what path to volume-ify", NULL, arg_mandatory}, - { NULL, 0, arg_end, NULL } + struct agetargs args[] = { + {"part", 0, aarg_string, NULL, + "what part to use", NULL, aarg_mandatory}, + {"vol", 0, aarg_integer, NULL, + "what vol-number to use", NULL, aarg_mandatory}, + {"path", 0, aarg_string, NULL, + "what path to volume-ify", NULL, aarg_mandatory}, + { NULL, 0, aarg_end, NULL } }, *arg; arg = args; @@ -570,8 +575,8 @@ fvolcreate_cmd (int argc, char **argv) arg->value = &vol_int; arg++; arg->value = &path_str; arg++; - if (getarg (args, argc, argv, &optind, ARG_AFSSTYLE)) { - arg_printusage(args, "volvnode", NULL, ARG_AFSSTYLE); + if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) { + aarg_printusage(args, "volvnode", NULL, AARG_AFSSTYLE); INTER_RETURN(1); } @@ -651,20 +656,23 @@ salvage_cmd (int argc, char **argv) int ret, optind = 0; struct volume_handle *volh; - struct getargs args[] = { - {"part", 0, arg_string, NULL, - "what part to use", NULL, arg_mandatory}, - {"vol", 0, arg_integer, NULL, - "what vol-number to use", NULL, arg_mandatory}, - { NULL, 0, arg_end, NULL } + struct agetargs args[] = { + {"part", 0, aarg_string, NULL, + "what part to use", NULL, aarg_mandatory}, + {"vol", 0, aarg_integer, NULL, + "what vol-number to use", NULL, aarg_mandatory}, + {"partdir", 0, aarg_string, NULL, + "where to find vicep*", NULL, aarg_optional}, + { NULL, 0, aarg_end, NULL } }, *arg; arg = args; arg->value = &part_str; arg++; arg->value = &vol; arg++; + arg->value = &dpart_root; arg++; - if (getarg (args, argc, argv, &optind, ARG_AFSSTYLE)) { - arg_printusage(args, "volvnode", NULL, ARG_AFSSTYLE); + if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) { + aarg_printusage(args, "volvnode", NULL, AARG_AFSSTYLE); INTER_RETURN(1); } @@ -766,7 +774,14 @@ int main (int argc, char **argv) { int ret; - char *log_name = "/dev/stderr"; + Log_method *method; + char *log_file = "/dev/stderr"; + + set_progname (argv[0]); + + method = log_open (get_progname(), log_file); + if (method == NULL) + errx (1, "log_open failed"); /* * We only boot, not init since we dont want to read in all volumes @@ -774,7 +789,7 @@ main (int argc, char **argv) vld_boot (); mnode_init (173); - mlog_loginit (log_name, milko_deb_units, MDEFAULT_LOG /* MDEBALL */); + mlog_loginit (method, milko_deb_units, MDEFAULT_LOG /* MDEBALL */); /* * Command loop or if command, eval. diff --git a/usr.sbin/afs/src/milko/bos/Makefile.in b/usr.sbin/afs/src/milko/bos/Makefile.in index 9f2fcc922b6..b4f9063705c 100644 --- a/usr.sbin/afs/src/milko/bos/Makefile.in +++ b/usr.sbin/afs/src/milko/bos/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:12 art Exp $ +# $KTH: Makefile.in,v 1.9 2000/10/10 20:56:20 lha Exp $ srcdir = @srcdir@ +top_builddir = ../.. VPATH = @srcdir@ CC = @CC@ @@ -36,6 +37,7 @@ INCLUDES = -I$(srcdir)/../.. \ -I$(srcdir)/../../include \ -I$(srcdir)/../lib/msecurity \ -I../../rxdef \ + @INC_roken@ \ $(RXKADINC) DEFINES = -DDEBUG REALCFLAGS = $(INCLUDES) @KRB4_INC_FLAGS@ $(DEFINES) $(CFLAGS) -DRXDEBUG @@ -48,13 +50,14 @@ LIBS = -L../../rxdef -lrxvlserver \ -L../../lib/ko -lko \ -L../../util -lutil \ -L../../lwp -llwp @PLWP_LIB_FLAGS@ \ - -L../../lib/roken -lroken $(RXKADLIB) \ + $(RXKADLIB) \ $(KAFS_LIBS) \ -L../../rxdef -lbosserver \ + @LIB_roken@ \ @LIBS@ LIBDEPENDS = ../../rxdef/libbosserver.a ../../rx/librx.a \ ../../lwp/liblwp.a ../../util/libutil.a \ - ../../lib/roken/libroken.a ../../lib/ko/libko.a \ + ../../lib/ko/libko.a \ ../lib/msecurity/libmsecurity.a \ ../../rxdef/libbosserver.a PROGS = bosserver diff --git a/usr.sbin/afs/src/milko/bos/bos_locl.h b/usr.sbin/afs/src/milko/bos/bos_locl.h index d1ebca44aa1..66b341b8caa 100644 --- a/usr.sbin/afs/src/milko/bos/bos_locl.h +++ b/usr.sbin/afs/src/milko/bos/bos_locl.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -64,7 +59,7 @@ #include <roken.h> #include <err.h> -#include <getarg.h> +#include <agetarg.h> #include <bos.h> #include <bos.ss.h> diff --git a/usr.sbin/afs/src/milko/bos/bosprocs.c b/usr.sbin/afs/src/milko/bos/bosprocs.c index 991efe719b0..16904c421d7 100644 --- a/usr.sbin/afs/src/milko/bos/bosprocs.c +++ b/usr.sbin/afs/src/milko/bos/bosprocs.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "bos_locl.h" -RCSID("$Id: bosprocs.c,v 1.1 2000/09/11 14:41:12 art Exp $"); +RCSID("$KTH: bosprocs.c,v 1.4 2000/10/03 00:16:53 lha Exp $"); /* * @@ -115,7 +110,7 @@ BOZO_SetStatus(struct rx_call *call, int BOZO_EnumerateInstance(struct rx_call *call, const int32_t instance, - char **iname) + char *iname) { bosdebug ("BOZO_EnumerateInstance: %d\n", instance); @@ -129,14 +124,12 @@ BOZO_EnumerateInstance(struct rx_call *call, int BOZO_GetInstanceInfo(struct rx_call *call, const char *instance, - char **type, + char *type, struct bozo_status *status) { bosdebug ("BOZO_GetInstanceInfo: %s\n", instance); -#if 0 - strcpy (type, "simple"); -#endif + strlcpy (type, "simple", BOZO_BSSIZE); memset (status, 0, sizeof(*status)); return 0; } @@ -150,13 +143,368 @@ int BOZO_GetInstanceParm(struct rx_call *call, const char *instance, const int32_t num, - char **param) + char *param) { bosdebug ("BOZO_GetInstanceParm: %s %d\n", instance, num); -#if 0 - strcpy (param, "foo"); -#endif + strlcpy (param, "foo", BOZO_BSSIZE); return 0; } +/* + * + */ + +int +BOZO_AddSUser(struct rx_call *call, const char *name) +{ + char *n; + int ret; + + if (strchr(name, '@')) + n = strdup (name); + else + asnprintf (&n, BOZO_BSSIZE, "%s@%s", name, cell_getthiscell()); + if (n == NULL) + return BZIO; + ret = sec_add_superuser (n); + free (n); + if (ret) + return BZIO; + return 0; +} + + +/* + * + */ + +int +BOZO_DeleteSUser(struct rx_call *call, const char *name) +{ + char *n; + int ret; + + if (strchr(name, '@')) + asnprintf (&n, BOZO_BSSIZE, "%s", name); + else + asnprintf (&n, BOZO_BSSIZE, "%s@%s", name, cell_getthiscell()); + if (n == NULL) + return BZIO; + ret = sec_del_superuser (n); + free (n); + if (ret) + return BZIO; + return 0; +} + + +/* + * + */ + +int +BOZO_ListSUsers(struct rx_call *call, const /* + * + */ + +int32_t an, char *name) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_ListKeys(struct rx_call *call, const int32_t an, int32_t *kvno, + struct bozo_key *key, struct bozo_keyInfo *keinfo) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_AddKey(struct rx_call *call, const int32_t an, + const struct bozo_key *key) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_DeleteKey(struct rx_call *call, const /* + * + */ + +int32_t an) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_SetCellName(struct rx_call *call, const char *name) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_GetCellName(struct rx_call *call, char *name) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_GetCellHost(struct rx_call *call, const int32_t awhich, char *name) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_AddCellHost(struct rx_call *call, const char *name) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_DeleteCellHost(struct rx_call *call, const char *name) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_SetTStatus(struct rx_call *call, const char *instance, + const /* + * + */ + +int32_t status) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_ShutdownAll(struct rx_call *call) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_RestartAll(struct rx_call *call) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_StartupAll(struct rx_call *call) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_SetNoAuthFlag(struct rx_call *call, const /* + * + */ + +int32_t flag) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_ReBozo(struct rx_call *call) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_Restart(struct rx_call *call, const char *instance) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_Install(struct rx_call *call, const char *path, const int32_t size, + const int32_t flags, const int32_t date) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_UnInstall(struct rx_call *call, const char *path) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_GetDates(struct rx_call *call, const char *path, int32_t *newtime, + int32_t *baktime, int32_t *oldtime) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_Exec(struct rx_call *call, const char *cmd) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_Prune(struct rx_call *call, const int32_t flags) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_SetRestartTime(struct rx_call *call, const int32_t type, + const struct bozo_netKTime *restartTime) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_GetRestartTime(struct rx_call *call, const int32_t type, + struct bozo_netKTime *restartTime) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_GetLog(struct rx_call *call, const char *name) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_WaitAll(struct rx_call *call) +{ + return -1; +} + + +/* + * + */ + +int +BOZO_GetInstanceStrings(struct rx_call *call, const char *instance, + char *errorname, char *spare1, char *spare2, char *spare3) +{ + return -1; +} + diff --git a/usr.sbin/afs/src/milko/bos/bosserver.c b/usr.sbin/afs/src/milko/bos/bosserver.c index c7b5231d57c..3adc90ebcab 100644 --- a/usr.sbin/afs/src/milko/bos/bosserver.c +++ b/usr.sbin/afs/src/milko/bos/bosserver.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "bos_locl.h" -RCSID("$Id: bosserver.c,v 1.1 2000/09/11 14:41:12 art Exp $"); +RCSID("$KTH: bosserver.c,v 1.22 2000/10/03 00:16:58 lha Exp $"); static char *email = "root"; static char *serverfile = MILKO_SYSCONFDIR "/server-file"; @@ -53,11 +48,11 @@ typedef struct mtype { pid_t pid; /* pid of server */ time_t last_start; /* last started */ struct { - unsigned long email:1; /* email when event happens */ - unsigned long savecore:1; /* try to save the corefile */ - unsigned long trydebug:1; /* try to include debugging */ - unsigned long restart_p:1; /* needs to be restarted */ - unsigned long enablep:1; /* is enabled */ + unsigned email:1; /* email when event happens */ + unsigned savecore:1; /* try to save the corefile */ + unsigned trydebug:1; /* try to include debugging */ + unsigned restart_p:1; /* needs to be restarted */ + unsigned enablep:1; /* is enabled */ } flags; struct mtype *next; /* next server on linked list */ } mtype; @@ -150,6 +145,26 @@ find_and_remove_server (struct mtype **old_srv, const char *name) } /* + * find server named `name' in linked list `old_srv'. + * If `name' isn't found, return NULL. + */ + +static struct mtype * +find_server (struct mtype **old_srv, const char *name) +{ + struct mtype *srv = *old_srv; + + while (srv) { + if (srv->name && strcasecmp (name, srv->name) == 0) { + return srv; + } + srv = srv->next; + } + return NULL; +} + + +/* * */ @@ -203,7 +218,7 @@ write_serverfile (struct mtype *s, const char *fn) FILE *f; f = fopen (fn, "w"); - if (f) { + if (f == NULL) { errx (1, "failed to open serverfile (%s) for writing", serverfile); } @@ -224,39 +239,34 @@ static void read_config_file (char *filename) { kconf_context context; - kconf_config_section *c; + kconf_config_section *conf, *c; struct mtype *old_servers; + struct mtype *s; const char *str; - int lineno; FILE *f; int ret; kconf_init (&context); - ret = kconf_config_parse_file (filename, &c); + ret = kconf_config_parse_file (filename, &conf); if (ret) { shutdown_servers (servers); errx (1, "read_config_file"); } email = - estrdup (kconf_config_get_string_default (context, c, + estrdup (kconf_config_get_string_default (context, conf, email, "bos", "email", NULL)); serverfile = - estrdup (kconf_config_get_string_default (context, c, + estrdup (kconf_config_get_string_default (context, conf, serverfile, "bos", "serverfile", NULL)); - f = fopen (serverfile, "r"); - if (f == NULL) { - shutdown_servers (servers); - err (1, "tried to open serverfile \"%s\"", serverfile); - } /* * Save the old list of servers @@ -264,30 +274,25 @@ read_config_file (char *filename) old_servers = servers; servers = NULL; + c = conf; - /* - * reread server list copy over existing servers to new list, add - * new servers - */ - - lineno = 0; - while (!feof (f)) { - struct mtype *s; - char name[100]; - int enablep; + while (c) { + char *name; + + if (!strcmp (c->name, "bos")) { + c = c->next; + continue; + } - lineno ++; - ret = fscanf (f, "%s %d", name, &enablep); - if (ret == EOF) - break; - if (ret != 2) { + name = c->name; + + if (name == NULL) { shutdown_servers (servers); shutdown_servers (old_servers); - errx (1, "error scaning line %d of serverfile (%s)", - lineno, serverfile); + errx (1, "error in config file (%s)", filename); } - str = kconf_config_get_string (context, c, + str = kconf_config_get_string (context, conf, name, "arguments", NULL); @@ -304,31 +309,31 @@ read_config_file (char *filename) s = new_server (name); if (str) s->arg = estrdup (str); - } - if (s->flags.enablep != enablep) + + s->flags.enablep = 1; s->flags.restart_p = 1; - s->flags.enablep = enablep; + } - s->flags.email = kconf_config_get_bool_default (context, c, + s->flags.email = kconf_config_get_bool_default (context, conf, KCONF_FALSE, name, "email", NULL); s->program = - estrdup (kconf_config_get_string_default (context, c, + estrdup (kconf_config_get_string_default (context, conf, name, name, "program", NULL)); s->coredir = - estrdup (kconf_config_get_string_default (context, c, + estrdup (kconf_config_get_string_default (context, conf, MILKO_LIBEXECDIR, name, "coredir", NULL)); s->flags.savecore = - kconf_config_get_bool_default (context, c, + kconf_config_get_bool_default (context, conf, KCONF_FALSE, name, "savecore", @@ -336,7 +341,7 @@ read_config_file (char *filename) s->flags.trydebug = - kconf_config_get_bool_default (context, c, + kconf_config_get_bool_default (context, conf, KCONF_FALSE, name, "trydebug", @@ -344,9 +349,36 @@ read_config_file (char *filename) s->next = servers; servers = s; + c = c->next; } - fclose (f); + f = fopen (serverfile, "r"); + if (f == NULL) { + shutdown_servers (old_servers); +/* err (1, "tried to open serverfile \"%s\"", serverfile);*/ + } else { + int lineno = 0; + while (!feof (f)) { + char name[100]; + int enablep; + lineno ++; + ret = fscanf (f, "%s %d", name, &enablep); + if (ret == EOF) + break; + if (ret != 2) { + errx (1, "error scaning line %d of serverfile (%s)", + lineno, serverfile); + } + + s = find_server (&servers, name); + if (s && s->flags.enablep != enablep) { + s->flags.enablep = enablep; + s->flags.restart_p = enablep; + } + } + fclose (f); + } + /* * nuke the old ones and write down a new serverfile @@ -367,7 +399,7 @@ start_server (struct mtype *server) time_t newtime = time(NULL); bosdebug ("starting server %s (%s)\n", server->name, - server->path); + server->program); if (newtime + 10 < server->last_start && server->last_start != 0) { @@ -383,7 +415,7 @@ start_server (struct mtype *server) case 0: { char *newargv[3]; - newargv[0] = server->path; + newargv[0] = server->program; #if 1 newargv[1] = NULL; #else @@ -396,9 +428,9 @@ start_server (struct mtype *server) close (2); } - execvp (server->path, newargv); + execvp (server->program, newargv); - bosdebug ("server %s failed with %s (%d)\n", server->path, + bosdebug ("server %s failed with %s (%d)\n", server->program, strerror (errno), errno); exit (1); break; @@ -545,24 +577,26 @@ static int do_help = 0; static char *srvtab_file = NULL; static int no_auth = 0; static char *configfile = MILKO_SYSCONFDIR "/bos.conf"; +static char *log_file = "syslog"; -static struct getargs args[] = { - {"cell", 0, arg_string, &cell, "what cell to use", NULL}, - {"realm", 0, arg_string, &realm, "what realm to use"}, - {"prefix",'p', arg_string, &bosserverprefix, +static struct agetargs args[] = { + {"cell", 0, aarg_string, &cell, "what cell to use", NULL}, + {"realm", 0, aarg_string, &realm, "what realm to use"}, + {"prefix",'p', aarg_string, &bosserverprefix, "directory where servers is stored", NULL}, - {"noauth", 0, arg_flag, &no_auth, "disable authentication checks"}, - {"debug", 'd', arg_flag, &debug, "output debugging"}, - {"help", 'h', arg_flag, &do_help, "help"}, - {"srvtab",'s', arg_string, &srvtab_file, "what srvtab to use"}, - {"configfile", 'f', arg_string, &configfile, "configuration file"}, - { NULL, 0, arg_end, NULL } + {"noauth", 0, aarg_flag, &no_auth, "disable authentication checks"}, + {"debug", 'd', aarg_flag, &debug, "output debugging"}, + {"log", 'l', aarg_string, &log_file, "where output debugging"}, + {"help", 'h', aarg_flag, &do_help, "help"}, + {"srvtab",'s', aarg_string, &srvtab_file, "what srvtab to use"}, + {"configfile", 'f', aarg_string, &configfile, "configuration file"}, + { NULL, 0, aarg_end, NULL } }; static void usage(int exit_code) { - arg_printusage(args, NULL, "", ARG_AFSSTYLE); + aarg_printusage(args, NULL, "", AARG_AFSSTYLE); exit (exit_code); } @@ -573,10 +607,13 @@ usage(int exit_code) int main (int argc, char **argv) { - int ret; + Log_method *method; int optind = 0; + int ret; - if (getarg (args, argc, argv, &optind, ARG_AFSSTYLE)) { + set_progname(argv[0]); + + if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) { usage (1); } @@ -594,10 +631,13 @@ main (int argc, char **argv) if (bosserverprefix == NULL) bosserverprefix = MILKO_LIBEXECDIR; - read_config_file (configfile); - + method = log_open (get_progname(), log_file); + if (method == NULL) + errx (1, "log_open failed"); + cell_init(0, method); ports_init(); - cell_init(0); + + read_config_file (configfile); if (no_auth) sec_disable_superuser_check (); @@ -627,4 +667,3 @@ main (int argc, char **argv) return 0; } - diff --git a/usr.sbin/afs/src/milko/bos/kconf.c b/usr.sbin/afs/src/milko/bos/kconf.c index 35d0c534556..a3804fb61ef 100644 --- a/usr.sbin/afs/src/milko/bos/kconf.c +++ b/usr.sbin/afs/src/milko/bos/kconf.c @@ -49,7 +49,7 @@ /* $Heimdal: config_file.c,v 1.38 1999/12/02 17:05:08 joda Exp $ */ #ifdef RCSID -RCSID("$Id: kconf.c,v 1.1 2000/09/11 14:41:12 art Exp $"); +RCSID("$KTH: kconf.c,v 1.3 2000/05/27 21:56:56 ahltorp Exp $"); #endif static int parse_section(char *p, kconf_config_section **s, diff --git a/usr.sbin/afs/src/milko/fs/Makefile.in b/usr.sbin/afs/src/milko/fs/Makefile.in index ef9bc05ef5d..432be5ae80e 100644 --- a/usr.sbin/afs/src/milko/fs/Makefile.in +++ b/usr.sbin/afs/src/milko/fs/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:13 art Exp $ +# $KTH: Makefile.in,v 1.19 2000/10/10 20:56:23 lha Exp $ srcdir = @srcdir@ +top_builddir = ../.. VPATH = @srcdir@ CC = @CC@ @@ -45,6 +46,7 @@ INCLUDES = -I$(srcdir)/../.. \ -I$(srcdir)/../lib/vstatus \ -I../lib/vstatus \ -I../../rxdef \ + @INC_roken@ \ $(RXKADINC) DEFINES = -DDEBUG REALCFLAGS = $(INCLUDES) @KRB4_INC_FLAGS@ $(DEFINES) $(CFLAGS) -DRXDEBUG @@ -65,12 +67,13 @@ LIBS = -L../lib/mlog -lmlog \ -L../../util -lutil \ -L../../rxdef -lrxvolserver -lrxfsserver -L../../rx -lrx \ -L../../lwp -llwp @PLWP_LIB_FLAGS@ \ - -L../../lib/roken -lroken $(RXKADLIB) \ + $(RXKADLIB) \ $(KAFS_LIBS) \ + @LIB_roken@ \ @LIBS@ LIBDEPENDS = ../../rxdef/librxdefclient.a ../../rx/librx.a \ ../../lwp/liblwp.a ../../util/libutil.a \ - ../../lib/roken/libroken.a ../../lib/ko/libko.a \ + ../../lib/ko/libko.a \ ../lib/voldb/libvoldb.a ../lib/vld/libvld.a \ ../lib/msecurity/libmsecurity.a ../../lib/ko/libko.a \ ../lib/dpart/libdpart.a ../../rxdef/libptclient.a \ diff --git a/usr.sbin/afs/src/milko/fs/connsec.c b/usr.sbin/afs/src/milko/fs/connsec.c index e8b4722b745..32397b245ce 100644 --- a/usr.sbin/afs/src/milko/fs/connsec.c +++ b/usr.sbin/afs/src/milko/fs/connsec.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -40,7 +35,7 @@ #include "pts.cs.h" -RCSID("$Id: connsec.c,v 1.1 2000/09/11 14:41:13 art Exp $"); +RCSID("$KTH: connsec.c,v 1.12 2000/10/03 00:17:03 lha Exp $"); static struct rx_connection * get_conn(int32_t addr, int32_t port, int32_t servid) @@ -151,7 +146,6 @@ fs_connsec_createconn(struct rx_connection *conn) char inst[INST_SZ]; char realm[REALM_SZ]; int32_t over; - int rnamelen; if (conn->rock) return; diff --git a/usr.sbin/afs/src/milko/fs/connsec.h b/usr.sbin/afs/src/milko/fs/connsec.h index e7e64e389ec..93e844086d6 100644 --- a/usr.sbin/afs/src/milko/fs/connsec.h +++ b/usr.sbin/afs/src/milko/fs/connsec.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/usr.sbin/afs/src/milko/fs/fileserver.c b/usr.sbin/afs/src/milko/fs/fileserver.c index f043010ae26..fc720c41586 100644 --- a/usr.sbin/afs/src/milko/fs/fileserver.c +++ b/usr.sbin/afs/src/milko/fs/fileserver.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "fsrv_locl.h" -RCSID("$Id: fileserver.c,v 1.1 2000/09/11 14:41:13 art Exp $"); +RCSID("$KTH: fileserver.c,v 1.25 2000/12/29 20:03:30 tol Exp $"); typedef enum { NO_SALVAGE, NORMAL_SALVAGE, SALVAGE_ALL } salvage_options_e; @@ -53,7 +48,7 @@ static char *cell = NULL; static char *realm = NULL; static char *srvtab_file = NULL; static char *debug_levels = NULL; -static char *log_name = "syslog"; +static char *log_file = "syslog"; static int no_auth = 0; static int force_salvage = 0; static int salvage_options = NORMAL_SALVAGE; @@ -65,8 +60,11 @@ static int salvage_options = NORMAL_SALVAGE; static void sigusr1 (int foo) { + char *dumpdir; printf ("sigusr1\n"); - chdir ("/vicepa"); + asprintf (&dumpdir, "%s/vicepa", dpart_root); + if (dumpdir) + chdir (dumpdir); exit (2); /* XXX profiler */ } @@ -139,21 +137,23 @@ attach_volumes(void) * Main */ -static struct getargs args[] = { - {"cell", 0, arg_string, &cell, "what cell to use"}, - {"realm", 0, arg_string, &realm, "what realm to use"}, - {"noauth", 0, arg_flag, &no_auth, "disable authentication checks"}, - {"debug", 0, arg_string, &debug_levels, "debug level"}, - {"log", 0, arg_string, &log_name, "log device name"}, - {"srvtab",'s', arg_string, &srvtab_file, "what srvtab to use"}, - {"salvage", 0, arg_flag, &force_salvage, "Force a salvage for all vols"}, - { NULL, 0, arg_end, NULL } +static struct agetargs args[] = { + {"cell", 0, aarg_string, &cell, "what cell to use"}, + {"realm", 0, aarg_string, &realm, "what realm to use"}, + {"noauth", 0, aarg_flag, &no_auth, "disable authentication checks"}, + {"debug", 0, aarg_string, &debug_levels, "debug level"}, + {"log", 'l', aarg_string, &log_file, + "where to write log (stderr (default), syslog, or path to file)"}, + {"srvtab",'s', aarg_string, &srvtab_file, "what srvtab to use"}, + {"salvage", 0, aarg_flag, &force_salvage, "Force a salvage for all vols"}, + {"partdir",'s', aarg_string, &dpart_root, "where to find vicep*"}, + { NULL, 0, aarg_end, NULL } }; static void usage(void) { - arg_printusage(args, "fileserver", "", ARG_GNUSTYLE); + aarg_printusage(args, "fileserver", "", AARG_GNUSTYLE); } int @@ -162,10 +162,11 @@ main(int argc, char **argv) int ret; int optind = 0; PROCESS pid; + Log_method *method; set_progname (argv[0]); - if (getarg (args, argc, argv, &optind, ARG_GNUSTYLE)) { + if (agetarg (args, argc, argv, &optind, AARG_GNUSTYLE)) { usage (); return 1; } @@ -178,20 +179,24 @@ main(int argc, char **argv) return 1; } + method = log_open (get_progname(), log_file); + if (method == NULL) + errx (1, "log_open failed"); + cell_init(0, method); + ports_init(); + printf ("fileserver booting\n"); LWP_InitializeProcessSupport (LWP_NORMAL_PRIORITY, &pid); - mlog_loginit (log_name, milko_deb_units, MDEFAULT_LOG); + mlog_loginit (method, milko_deb_units, MDEFAULT_LOG); if (debug_levels) mlog_log_set_level (debug_levels); if (force_salvage) salvage_options = SALVAGE_ALL; - ports_init(); - cell_init(0); - ropa_init(400,1000); + ropa_init(30000, 100, 40000, 40000, 150, 50000); if (no_auth) sec_disable_superuser_check (); @@ -202,14 +207,14 @@ main(int argc, char **argv) network_kerberos_init (srvtab_file); ret = network_init(htons(afsport), "fs", FS_SERVICE_ID, - RXAFS_ExecuteRequest, &fsservice, NULL); + RXAFS_ExecuteRequest, &fsservice, realm); if (ret) errx (1, "network_init failed with %d", ret); fsservice->destroyConnProc = fs_connsec_destroyconn; ret = network_init(htons(afsvolport), "volser", VOLSER_SERVICE_ID, - VOLSER_ExecuteRequest, &volservice, NULL); + VOLSER_ExecuteRequest, &volservice, realm); if (ret) errx (1, "network_init failed with %d", ret); diff --git a/usr.sbin/afs/src/milko/fs/fs_def.h b/usr.sbin/afs/src/milko/fs/fs_def.h index 59fa433c578..8be00849bec 100644 --- a/usr.sbin/afs/src/milko/fs/fs_def.h +++ b/usr.sbin/afs/src/milko/fs/fs_def.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -40,7 +35,7 @@ * Fileserver global defines */ -/* $Id: fs_def.h,v 1.1 2000/09/11 14:41:13 art Exp $ */ +/* $KTH: fs_def.h,v 1.4 2000/10/03 00:17:19 lha Exp $ */ #ifndef __FILBUNKE__FS_DEF_H #define __FILBUNKE__FS_DEF_H 1 diff --git a/usr.sbin/afs/src/milko/fs/fsprocs.c b/usr.sbin/afs/src/milko/fs/fsprocs.c index 6883bb75874..a58428b79d3 100644 --- a/usr.sbin/afs/src/milko/fs/fsprocs.c +++ b/usr.sbin/afs/src/milko/fs/fsprocs.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "fsrv_locl.h" -RCSID("$Id: fsprocs.c,v 1.1 2000/09/11 14:41:13 art Exp $"); +RCSID("$KTH: fsprocs.c,v 1.55 2001/01/01 20:50:23 lha Exp $"); #define GETHOST(call) rx_HostOf(rx_PeerOf(rx_ConnectionOf((call)))) #define GETPORT(call) rx_PortOf(rx_PeerOf(rx_ConnectionOf((call)))) @@ -258,6 +253,9 @@ out: mnode_free (n, FALSE); vld_free (volh); + mlog_log (MDEBFS, "FetchData: ret = %d (at end), calleraccess = %x\n", + ret, a_fidStatP->CallerAccess); + return ret; } @@ -265,6 +263,18 @@ out: * */ +static int +i2nlist (idlist *ilist, namelist *nlist) +{ + /* XXX convert the number is the ilist to name-as-numbers */ + return ENETDOWN; +} + + +/* + * + */ + int RXAFS_FetchACL(struct rx_call *call, const struct AFSFid *a_dirFidP, @@ -315,8 +325,18 @@ RXAFS_FetchACL(struct rx_call *call, } ret = fs_connsec_idtoname(&ilist, &nlist); - if (ret) + switch (ret) { + case ENETDOWN : + case RX_CALL_DEAD : + + ret = i2nlist (&ilist, &nlist); + if (ret) + goto err_out; + + break; + default: goto err_out; + } tempacl = NULL; tempacl_old = strdup(""); @@ -413,6 +433,9 @@ RXAFS_FetchStatus(struct rx_call *call, mnode_free (n, FALSE); vld_free (volh); + mlog_log (MDEBFS, "FetchStatus: ret = %d (at end), calleraccess = %x\n", + ret, a_currStatP->CallerAccess); + return ret; } @@ -501,8 +524,8 @@ RXAFS_StoreData(struct rx_call *call, mnode_free (n, FALSE); vld_free (volh); - mlog_log (MDEBFS, "StoreData: ret = %d (at end), len = %d", - ret, a_fidStatP->Length); + mlog_log (MDEBFS, "StoreData: ret = %d (at end), len = %d, calleraccess = %x", + ret, a_fidStatP->Length, a_fidStatP->CallerAccess); return ret; } @@ -614,6 +637,7 @@ RXAFS_StoreACL(struct rx_call *call, if (ret) goto err_out; + fs_update_fs (n, &m, a_dirNewStatP); ropa_break_callback (GETHOST(call), GETPORT(call), a_dirFidP, FALSE); vld_vld2volsync (volh, a_volSyncP); @@ -621,7 +645,7 @@ RXAFS_StoreACL(struct rx_call *call, err_out: mnode_free (n, FALSE); vld_free (volh); - return 0; + return ret; } /* @@ -685,11 +709,11 @@ removenode (struct rx_call *call, struct volume_handle *volh; struct mnode *n; struct msec m; - VenusFid fid; + VenusFid parentFid, fid; int ret; int32_t new_len; - m.flags = VOLOP_GETSTATUS|VOLOP_DELETE|VOLOP_PARENT; + m.flags = VOLOP_GETSTATUS|VOLOP_DELETE; ret = fs_init_req (a_dirFidP, &m, &volh, call, &n); if (ret) @@ -700,7 +724,7 @@ removenode (struct rx_call *call, if (n->fs.FileType != TYPE_DIR) { mnode_free (n, FALSE); - return EPERM; + return ENOTDIR; } ret = fbuf_create (&the_fbuf, n->fd, n->fs.Length, @@ -711,23 +735,29 @@ removenode (struct rx_call *call, return ret; } + parentFid.Cell = 0; + parentFid.fid = n->fid; + + ret = fdir_lookup (&the_fbuf, &parentFid, a_name, &fid); + if (ret) { + fbuf_end (&the_fbuf); + mnode_free (n, FALSE); + vld_free (volh); + return ret; + } + + if (afs_dir_p (fid.fid.Vnode) != dirp) { + fbuf_end (&the_fbuf); + mnode_free (n, FALSE); + vld_free (volh); + return dirp ? ENOTDIR : EISDIR; + } + if (dirp) { fbuf dirfbuf; - struct mnode *parent_n; struct msec pm; - VenusFid parentFid, fid; - - parentFid.Cell = 0; - parentFid.fid = n->fid; + struct mnode *parent_n; - ret = fdir_lookup (&the_fbuf, &parentFid, a_name, &fid); - if (ret) { - fbuf_end (&the_fbuf); - mnode_free (n, FALSE); - vld_free (volh); - return ret; - } - pm.flags = VOLOP_GETSTATUS|VOLOP_READ|VOLOP_NOCHECK; fs_init_msec (call, &pm); pm.loop = m.loop + 1; @@ -791,7 +821,7 @@ removenode (struct rx_call *call, } } - ret = vld_modify_vnode (volh, n, NULL, NULL, &new_len); + ret = vld_modify_vnode (volh, n, &m, NULL, &new_len); fs_update_fs (n, &m, a_srvStatusP); @@ -855,7 +885,7 @@ RXAFS_CreateFile(struct rx_call *call, DirFid->Volume, DirFid->Vnode, DirFid->Unique, Name); - m.flags = VOLOP_GETSTATUS|VOLOP_INSERT|VOLOP_PARENT; + m.flags = VOLOP_GETSTATUS|VOLOP_INSERT; ret = fs_init_req (DirFid, &m, &volh, call, &n); if (ret) @@ -890,7 +920,7 @@ RXAFS_CreateFile(struct rx_call *call, if (ret == 0) { int32_t len = n->sb.st_size; - ret = vld_modify_vnode (volh, n, NULL, NULL, &len); + ret = vld_modify_vnode (volh, n, &m, NULL, &len); } if (ret) { @@ -921,9 +951,9 @@ RXAFS_CreateFile(struct rx_call *call, vld_vld2volsync (volh, a_volSyncP); vld_free (volh); - mlog_log (MDEBFS, "CreateFile: created fid: %d.%d.%d", + mlog_log (MDEBFS, "CreateFile: created fid: %d.%d.%d calleraccess: %x", OutFid->Volume, OutFid->Vnode, - OutFid->Unique); + OutFid->Unique, OutFidStatus->CallerAccess); return ret; } @@ -963,7 +993,7 @@ RXAFS_Rename(struct rx_call *call, if (a_origDirFidP->Volume != a_newDirFidP->Volume) return EXDEV; - orig_m.flags = VOLOP_GETSTATUS|VOLOP_DELETE|VOLOP_PARENT; + orig_m.flags = VOLOP_GETSTATUS|VOLOP_DELETE; if (a_origDirFidP->Vnode == a_newDirFidP->Vnode && a_origDirFidP->Unique == a_newDirFidP->Unique) orig_m.flags |= VOLOP_INSERT; @@ -1006,7 +1036,7 @@ RXAFS_Rename(struct rx_call *call, same_dir = TRUE; } else { - new_m.flags = VOLOP_GETSTATUS|VOLOP_INSERT|VOLOP_PARENT; + new_m.flags = VOLOP_GETSTATUS|VOLOP_INSERT; /* XXX */ ret = fs_init_req (a_newDirFidP, &new_m, &volh, call, &new_n); @@ -1074,10 +1104,10 @@ RXAFS_Rename(struct rx_call *call, if (ret == 0) { int32_t len; len = fbuf_len (&origfbuf); - vld_modify_vnode (volh, orig_n, NULL, NULL, &len); + vld_modify_vnode (volh, orig_n, &orig_m, NULL, &len); if (!same_dir) { len = fbuf_len (newfbufP); - vld_modify_vnode (volh, new_n, NULL, NULL, &len); + vld_modify_vnode (volh, new_n, &new_m, NULL, &len); } } @@ -1141,7 +1171,7 @@ RXAFS_Symlink(struct rx_call *call, a_dirFidP->Volume, a_dirFidP->Vnode, a_dirFidP->Unique, a_nameP, a_linkContentsP); - m.flags = VOLOP_GETSTATUS|VOLOP_INSERT|VOLOP_PARENT; + m.flags = VOLOP_GETSTATUS|VOLOP_INSERT; ret = fs_init_req (a_dirFidP, &m, &volh, call, &n); if (ret) { @@ -1207,7 +1237,7 @@ RXAFS_Symlink(struct rx_call *call, ret = fdir_creat (&the_fbuf, a_nameP, child); if (ret == 0) { int32_t len = fbuf_len (&the_fbuf); - vld_modify_vnode (volh, n, NULL, NULL, &len); + vld_modify_vnode (volh, n, &m, NULL, &len); } fbuf_end (&the_fbuf); /* XXX error ? */ @@ -1233,7 +1263,7 @@ RXAFS_Symlink(struct rx_call *call, if (ret == 0) { int32_t len32 = len; *a_newFidP = child; - vld_modify_vnode (volh, child_n, NULL, NULL, &len32); + vld_modify_vnode (volh, child_n, &child_m, NULL, &len32); fs_update_fs (n, &m, a_newDirStatP); fs_update_fs (child_n, &child_m, a_newFidStatP); vld_vld2volsync (volh, a_volSyncP); @@ -1263,7 +1293,119 @@ RXAFS_Link(struct rx_call *call, struct AFSFetchStatus *a_newDirStatP, struct AFSVolSync *a_volSyncP) { +#if 0 + struct volume_handle *volh; + VenusFid a_vchild, a_vdirFid; + AFSFid child; + fbuf the_fbuf; + struct mnode *n; + struct msec m; + struct mnode *child_n; + struct msec child_m; + int ret; + + mlog_log (MDEBFS, "Link: fid: %d.%d.%d name: %s existing", + a_dirFidP->Volume, a_dirFidP->Vnode, + a_dirFidP->Unique, a_nameP); + + m.flags = VOLOP_GETSTATUS|VOLOP_INSERT; + + ret = fs_init_req (a_dirFidP, &m, &volh, call, &n); + if (ret) { + mlog_log (MDEBFS, "Link: ret = %d (init_req)", ret); + return ret; + } + + assert (n->flags.fdp); + assert (n->flags.fsp); + + if (n->fs.FileType != TYPE_DIR) { + mnode_free (n, FALSE); + vld_free (volh); + mlog_log (MDEBFS, "Link: ret = %d (not DIR)", EPERM); + return EPERM; + } + + child_m.flags = VOLOP_GETSTATUS; + fs_init_msec (call, &child_m); + + ret = fs_open_node (a_dirFidP, volh, &child_m, &child_n); + if (ret) { + mlog_log(MDEBFS, "Link: Failed to open existing fid, ret = %d", ret); + goto out_parent; + } + + ret = vld_check_rights (volh, child_n, &child_m); + if (ret) { + mlog_log (MDEBFS, "Link: child right insufficient ret = %d", ret); + goto out_parent; + } + + ret = (child_n->fs.ParentVnode == a_dirFidP->Vnode + && child_n->fs.ParentUnique == a_dirFidP->Unique); + if (ret != 0) { + mnode_free (n, FALSE); + mlog_log (MDEBFS, "Link: ret = %d (not same volume)", EPERM); + ret = EPERM; + goto out_child; + } + + a_vdirFid.Cell = 0; + a_vdirFid.fid = *a_dirFidP; + + ret = fbuf_create (&the_fbuf, n->fd, n->sb.st_size, + FBUF_READ|FBUF_WRITE|FBUF_SHARED); + if (ret) { + mlog_log (MDEBFS, "Link: ret = %d (fbuf_create)", ret); + goto out_child; + } + + ret = fdir_lookup (&the_fbuf, &a_vdirFid, a_nameP, &a_vchild); + if (ret != ENOENT) { + fbuf_end (&the_fbuf); + if (ret == 0) { + mlog_log (MDEBFS, "Link: ret = %d (EEXIST)", EEXIST); + ret = EEXIST; + } else + mlog_log (MDEBFS, "Link: ret = %d (fdir_lookup)", ret); + goto out_child; + } + + child = *a_existingFidP; + child.Volume = volh->vol; + + /* XXX check name ! */ + ret = fdir_creat (&the_fbuf, a_nameP, child); + if (ret == 0) { + int32_t len = fbuf_len (&the_fbuf); + vld_modify_vnode (volh, n, &m, NULL, &len); + } + + fbuf_end (&the_fbuf); /* XXX error ? */ + + if (ret) { + mnode_remove (&child); + mlog_log (MDEBFS, "Link: ret = %d (fdir_creat)", ret); + goto out_child; + } + + assert (child_n->flags.fdp); + + fs_update_fs (n, &m, a_newDirStatP); + fs_update_fs (child_n, &child_m, a_newFidStatP); + vld_vld2volsync (volh, a_volSyncP); + ropa_break_callback (GETHOST(call), GETPORT(call), a_dirFidP, FALSE); + + out_child: + mnode_free (child_n, FALSE); + out_parent: + mnode_free (n, FALSE); + vld_free (volh); + + return ret; +#else return EPERM; +#endif } /* @@ -1293,7 +1435,7 @@ RXAFS_MakeDir(struct rx_call *call, a_parentDirFidP->Volume, a_parentDirFidP->Vnode, a_parentDirFidP->Unique, a_newDirNameP); - m.flags = VOLOP_WRITE | VOLOP_INSERT | VOLOP_PARENT | VOLOP_GETSTATUS; + m.flags = VOLOP_WRITE | VOLOP_INSERT | VOLOP_GETSTATUS; ret = fs_init_req (a_parentDirFidP, &m, &volh, call, &n); if (ret) @@ -1339,7 +1481,7 @@ RXAFS_MakeDir(struct rx_call *call, return ret; } - ret = vld_modify_vnode (volh, n, NULL, NULL, NULL); + ret = vld_modify_vnode (volh, n, &m, NULL, NULL); if (ret) { /* XXX adjust directory size? */ vld_adjust_linkcount (volh, n, -1); diff --git a/usr.sbin/afs/src/milko/fs/fsrv_locl.h b/usr.sbin/afs/src/milko/fs/fsrv_locl.h index 1e8ffd7f25b..e26fcfc4ade 100644 --- a/usr.sbin/afs/src/milko/fs/fsrv_locl.h +++ b/usr.sbin/afs/src/milko/fs/fsrv_locl.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -37,7 +32,7 @@ */ /* - * $Id: fsrv_locl.h,v 1.1 2000/09/11 14:41:13 art Exp $ + * $KTH: fsrv_locl.h,v 1.11 2000/10/03 00:17:31 lha Exp $ */ @@ -68,7 +63,7 @@ #include <service.h> #include <part.h> -#include <getarg.h> +#include <agetarg.h> #include <fs.ss.h> #include <volumeserver.ss.h> diff --git a/usr.sbin/afs/src/milko/fs/volprocs.c b/usr.sbin/afs/src/milko/fs/volprocs.c index 2a26fdb3743..6c1bf48bb6c 100644 --- a/usr.sbin/afs/src/milko/fs/volprocs.c +++ b/usr.sbin/afs/src/milko/fs/volprocs.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "fsrv_locl.h" -RCSID("$Id: volprocs.c,v 1.1 2000/09/11 14:41:13 art Exp $"); +RCSID("$KTH: volprocs.c,v 1.9 2000/10/03 00:17:36 lha Exp $"); /* * Helper function diff --git a/usr.sbin/afs/src/milko/include/mdebug.h b/usr.sbin/afs/src/milko/include/mdebug.h index 466a9fe8d74..1a385df3703 100644 --- a/usr.sbin/afs/src/milko/include/mdebug.h +++ b/usr.sbin/afs/src/milko/include/mdebug.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -37,7 +32,7 @@ */ /* - * $Id: mdebug.h,v 1.1 2000/09/11 14:41:14 art Exp $ + * $KTH: mdebug.h,v 1.5 2000/10/03 00:17:42 lha Exp $ */ #ifndef _mdebug_h diff --git a/usr.sbin/afs/src/milko/lib/Makefile.in b/usr.sbin/afs/src/milko/lib/Makefile.in index f6aebe69405..b19c3731f6d 100644 --- a/usr.sbin/afs/src/milko/lib/Makefile.in +++ b/usr.sbin/afs/src/milko/lib/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:14 art Exp $ +# $KTH: Makefile.in,v 1.8 2000/10/08 06:22:51 lha Exp $ srcdir = @srcdir@ +top_builddir = ../.. VPATH = @srcdir@ SHELL = /bin/sh diff --git a/usr.sbin/afs/src/milko/lib/dpart/Makefile.in b/usr.sbin/afs/src/milko/lib/dpart/Makefile.in index 74217053f53..83c1aba5cfb 100644 --- a/usr.sbin/afs/src/milko/lib/dpart/Makefile.in +++ b/usr.sbin/afs/src/milko/lib/dpart/Makefile.in @@ -1,10 +1,11 @@ # -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:14 art Exp $ +# $KTH: Makefile.in,v 1.4 2000/10/08 06:22:58 lha Exp $ # SHELL = /bin/sh srcdir = @srcdir@ +top_builddir = ../../.. VPATH = @srcdir@ CC = @CC@ diff --git a/usr.sbin/afs/src/milko/lib/dpart/dpart.c b/usr.sbin/afs/src/milko/lib/dpart/dpart.c index ea4de472b6a..e29b3a11128 100644 --- a/usr.sbin/afs/src/milko/lib/dpart/dpart.c +++ b/usr.sbin/afs/src/milko/lib/dpart/dpart.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -55,7 +50,13 @@ #include <dpart.h> -RCSID("$Id: dpart.c,v 1.1 2000/09/11 14:41:14 art Exp $"); +RCSID("$KTH: dpart.c,v 1.6 2000/12/29 20:12:35 tol Exp $"); + +#ifdef MILKO_ROOT +char *dpart_root = MILKO_ROOT; +#else +char *dpart_root = ""; +#endif /* * Allocate a dp_part structure for partition `num' and @@ -90,8 +91,8 @@ dp_create (u_int32_t num, struct dp_part **dp) ptr[0] = num + 'a'; ptr[1] = '\0'; - ret = asprintf (&d->part, "/vicep%s", str); - if (ret != 7) { + ret = asprintf (&d->part, "%s/vicep%s", dpart_root, str); + if (ret < 0) { free (d); return EINVAL; } diff --git a/usr.sbin/afs/src/milko/lib/dpart/dpart.h b/usr.sbin/afs/src/milko/lib/dpart/dpart.h index 7a73fa39b85..d9980299411 100644 --- a/usr.sbin/afs/src/milko/lib/dpart/dpart.h +++ b/usr.sbin/afs/src/milko/lib/dpart/dpart.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: dpart.h,v 1.1 2000/09/11 14:41:14 art Exp $ */ +/* $KTH: dpart.h,v 1.6 2000/12/29 20:12:36 tol Exp $ */ #ifndef __FILBULKE_DPART_H #define __FILBULKE_DPART_H 1 @@ -47,6 +42,8 @@ struct dp_part { int ref; }; +extern char *dpart_root; + #define DP_NUMBER(dp) ((dp)->num) #define DP_NAME(dp) ((dp)->part) diff --git a/usr.sbin/afs/src/milko/lib/mlog/Makefile.in b/usr.sbin/afs/src/milko/lib/mlog/Makefile.in index 3b8557f422d..711870be45f 100644 --- a/usr.sbin/afs/src/milko/lib/mlog/Makefile.in +++ b/usr.sbin/afs/src/milko/lib/mlog/Makefile.in @@ -1,11 +1,13 @@ # -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:15 art Exp $ +# $KTH: Makefile.in,v 1.4 2000/12/04 23:06:19 lha Exp $ # -SHELL = /bin/sh +SHELL = /bin/sh -srcdir = @srcdir@ -VPATH = @srcdir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = ../../.. +VPATH = @srcdir@ CC = @CC@ AR = ar @@ -14,7 +16,7 @@ INCLUDES = -I. \ -I$(srcdir) \ -I../../../rxdef \ -I$(srcdir) \ - -I$(srcdir) \ + -I$(top_srcdir) \ -I../../../include \ $(KRB4_INC_FLAGS) \ -I$(srcdir)/../../../include diff --git a/usr.sbin/afs/src/milko/lib/mlog/mlog.c b/usr.sbin/afs/src/milko/lib/mlog/mlog.c index d3b961839e9..a14c0d2a8d9 100644 --- a/usr.sbin/afs/src/milko/lib/mlog/mlog.c +++ b/usr.sbin/afs/src/milko/lib/mlog/mlog.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -49,7 +44,7 @@ #include "mlog.h" -RCSID("$Id: mlog.c,v 1.1 2000/09/11 14:41:15 art Exp $"); +RCSID("$KTH: mlog.c,v 1.8 2000/10/03 00:17:58 lha Exp $"); static Log_method* mlog_log_method = NULL; static Log_unit* mlog_log_unit = NULL; @@ -68,16 +63,14 @@ mlog_log(unsigned level, char *fmt, ...) } void -mlog_loginit(char *log, struct units *deb_units, unsigned default_level) +mlog_loginit(Log_method *method, + struct units *deb_units, + unsigned default_level) { - assert (log); + assert (deb_units && method && mlog_deb_units == NULL); - assert (deb_units && mlog_deb_units == NULL); - mlog_deb_units = deb_units; - mlog_log_method = log_open("milko", log); - if (mlog_log_method == NULL) - errx (1, "mlog_loginit: log_open failed with log `%s'", log); + mlog_log_method = method; mlog_log_unit = log_unit_init (mlog_log_method, "milko", mlog_deb_units, default_level); if (mlog_log_unit == NULL) diff --git a/usr.sbin/afs/src/milko/lib/mlog/mlog.h b/usr.sbin/afs/src/milko/lib/mlog/mlog.h index aa91230bdc6..cdaff4e506d 100644 --- a/usr.sbin/afs/src/milko/lib/mlog/mlog.h +++ b/usr.sbin/afs/src/milko/lib/mlog/mlog.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -37,7 +32,7 @@ */ /* - * $Id: mlog.h,v 1.1 2000/09/11 14:41:15 art Exp $ + * $KTH: mlog.h,v 1.4 2000/10/03 00:18:03 lha Exp $ */ #ifndef _arladeb_h @@ -51,7 +46,8 @@ #include <parse_units.h> void mlog_log(unsigned level, char *fmt, ...); -void mlog_loginit(char *log, struct units *deb_units, unsigned default_level); +void mlog_loginit(Log_method *method, struct units *deb_units, + unsigned default_level); void mlog_log_set_level (const char *s); void mlog_log_set_level_num (unsigned level); void mlog_log_get_level (char *s, size_t len); diff --git a/usr.sbin/afs/src/milko/lib/msecurity/Makefile.in b/usr.sbin/afs/src/milko/lib/msecurity/Makefile.in index 0fd6c27e993..01796b19d3f 100644 --- a/usr.sbin/afs/src/milko/lib/msecurity/Makefile.in +++ b/usr.sbin/afs/src/milko/lib/msecurity/Makefile.in @@ -1,10 +1,11 @@ # -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:15 art Exp $ +# $KTH: Makefile.in,v 1.5 2000/10/08 06:23:11 lha Exp $ # SHELL = /bin/sh srcdir = @srcdir@ +top_builddir = ../../.. VPATH = @srcdir@ CC = @CC@ diff --git a/usr.sbin/afs/src/milko/lib/msecurity/msecurity.c b/usr.sbin/afs/src/milko/lib/msecurity/msecurity.c index 2eedb91d56a..6821736e6c6 100644 --- a/usr.sbin/afs/src/milko/lib/msecurity/msecurity.c +++ b/usr.sbin/afs/src/milko/lib/msecurity/msecurity.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -72,7 +67,7 @@ #include "msecurity.h" #include "acl.h" -RCSID("$Id: msecurity.c,v 1.1 2000/09/11 14:41:15 art Exp $"); +RCSID("$KTH: msecurity.c,v 1.9 2000/10/03 00:18:08 lha Exp $"); static char acl_file[] = MILKO_SYSCONFDIR "/superuserlist"; /* XXX */ diff --git a/usr.sbin/afs/src/milko/lib/msecurity/msecurity.h b/usr.sbin/afs/src/milko/lib/msecurity/msecurity.h index fdac3c156fb..3fc1d9fbc65 100644 --- a/usr.sbin/afs/src/milko/lib/msecurity/msecurity.h +++ b/usr.sbin/afs/src/milko/lib/msecurity/msecurity.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: msecurity.h,v 1.1 2000/09/11 14:41:15 art Exp $ */ +/* $KTH: msecurity.h,v 1.5 2000/10/03 00:18:14 lha Exp $ */ void sec_disable_superuser_check (void); diff --git a/usr.sbin/afs/src/milko/lib/msecurity/netinit.c b/usr.sbin/afs/src/milko/lib/msecurity/netinit.c index 2657b268f85..88521071b49 100644 --- a/usr.sbin/afs/src/milko/lib/msecurity/netinit.c +++ b/usr.sbin/afs/src/milko/lib/msecurity/netinit.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -59,7 +54,7 @@ #include <unistd.h> #endif -RCSID("$Id: netinit.c,v 1.1 2000/09/11 14:41:15 art Exp $"); +RCSID("$KTH: netinit.c,v 1.14 2000/10/03 00:18:19 lha Exp $"); /* * Network functions diff --git a/usr.sbin/afs/src/milko/lib/msecurity/netinit.h b/usr.sbin/afs/src/milko/lib/msecurity/netinit.h index ac37802e0bc..16152e943b3 100644 --- a/usr.sbin/afs/src/milko/lib/msecurity/netinit.h +++ b/usr.sbin/afs/src/milko/lib/msecurity/netinit.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: netinit.h,v 1.1 2000/09/11 14:41:15 art Exp $ */ +/* $KTH: netinit.h,v 1.8 2000/10/03 00:18:24 lha Exp $ */ void network_kerberos_init (char *srvtab); diff --git a/usr.sbin/afs/src/milko/lib/ropa/Makefile.in b/usr.sbin/afs/src/milko/lib/ropa/Makefile.in index acf1ecdd093..6eb10f61178 100644 --- a/usr.sbin/afs/src/milko/lib/ropa/Makefile.in +++ b/usr.sbin/afs/src/milko/lib/ropa/Makefile.in @@ -1,10 +1,11 @@ # -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:16 art Exp $ +# $KTH: Makefile.in,v 1.4 2000/10/08 06:23:18 lha Exp $ # SHELL = /bin/sh srcdir = @srcdir@ +top_builddir = ../../.. VPATH = @srcdir@ CC = @CC@ diff --git a/usr.sbin/afs/src/milko/lib/ropa/README b/usr.sbin/afs/src/milko/lib/ropa/README index 01b9e763fed..05eadce3412 100644 --- a/usr.sbin/afs/src/milko/lib/ropa/README +++ b/usr.sbin/afs/src/milko/lib/ropa/README @@ -3,7 +3,7 @@ Ropa - callbacks Thoughts by Love <lha@stacken.kth.se> -$Id: README,v 1.2 2001/10/24 10:23:53 dhartmei Exp $ +$KTH: README,v 1.1 1999/11/12 04:50:19 lha Exp $ Design ====== diff --git a/usr.sbin/afs/src/milko/lib/ropa/ropa.c b/usr.sbin/afs/src/milko/lib/ropa/ropa.c index ba50b7f5be0..7c88a02c5be 100644 --- a/usr.sbin/afs/src/milko/lib/ropa/ropa.c +++ b/usr.sbin/afs/src/milko/lib/ropa/ropa.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -74,9 +69,9 @@ #include <ropa.h> -RCSID("$Id: ropa.c,v 1.1 2000/09/11 14:41:16 art Exp $"); +RCSID("$KTH: ropa.c,v 1.28 2000/12/04 19:34:30 lha Exp $"); -#ifndef DIAGNOSTIC +#ifdef DIAGNOSTIC #define DIAGNOSTIC 1 #define DIAGNOSTIC_CLIENT 471114 #define DIAGNOSTIC_CHECK_CLIENT(c) assert((c)->magic == DIAGNOSTIC_CLIENT) @@ -93,12 +88,14 @@ RCSID("$Id: ropa.c,v 1.1 2000/09/11 14:41:16 art Exp $"); #define DIAGNOSTIC_CHECK_CCPAIR(c) #endif +#undef NO_CALLBACKS /* * Declarations */ #define ROPA_STACKSIZE (16*1024) +#define DEFAULT_TIMEOUT 600 struct ropa_client; @@ -112,14 +109,30 @@ struct ropa_addr { int mtu; /* */ }; +typedef enum { ROPAC_FREE, /* this entry is free for use */ + ROPAC_LOOKUP_U, /* pending RXAFSCB_WhoAreYou */ + ROPAC_LOOKUP, /* pending RXAFSCB_InitCallBackState */ + ROPAC_DEAD, /* is client doesn't respond */ + ROPAC_PLAIN, /* is a client w/o a UUID*/ + ROPAC_UUID /* is a client w/ a UUID */ +} ropa_state_t; + +enum { + ROPAF_LOOKUP = 0x1, /* pending a lookup => set WAITING, wait on addr(c) */ + ROPAF_WAITING = 0x2 /* wait on lookup to finish */ +}; + struct ropa_client { #ifdef DIAGNOSTIC int magic; /* magic */ #endif + ropa_state_t state; + unsigned flags; int numberOfInterfaces; afsUUID uuid; struct ropa_addr addr[AFS_MAX_INTERFACE_ADDR]; u_int16_t port; /* port of client in network byte order */ + struct rx_connection *conn; /* connection to client */ time_t lastseen; /* last got a message */ List *callbacks; /* list of ccpairs */ int ref; /* refence counter */ @@ -134,7 +147,6 @@ struct ropa_ccpair { /* heap object */ struct ropa_cb *cb; /* pointer to callback */ Listitem *cb_li; /* pointer to li on callback */ time_t expire; /* when this cb expire */ - int32_t version; /* version of this callback */ heap_ptr heap; /* heap pointer */ Listitem *li; /* where on lru */ }; @@ -153,8 +165,9 @@ static void break_callback (struct ropa_cb *cb,struct ropa_client *caller, Bool break_own); static void break_ccpair (struct ropa_ccpair *cc, Bool notify_clientp); static void break_client (struct ropa_client *c, Bool notify_clientp); -static void create_callbacks (void); -static void create_ccpairs (void); +static void create_callbacks (unsigned n); +static void create_ccpairs (unsigned n); +static void create_clients (unsigned n); static int uuid_magic_eq (afsUUID *uuid1, afsUUID *uuid2); static void debug_print_callbacks(void); @@ -162,10 +175,6 @@ static void debug_print_callbacks(void); * Module variables */ -#define NUM_CLIENTS 100 -#define NUM_CALLBACKS 300 -#define NUM_CCPAIR 600 - #define ROPA_MTU 1500 /* @@ -175,19 +184,22 @@ static void debug_print_callbacks(void); static Hashtab *ht_clients_ip = NULL; static Hashtab *ht_clients_uuid = NULL; static Hashtab *ht_callbacks = NULL; +static Hashtab *ht_ccpairs = NULL; /* least recently used on tail */ static List *lru_clients = NULL; static List *lru_ccpair = NULL; static List *lru_callback = NULL; -static unsigned long num_clients = 0; -static unsigned long num_callbacks = 0; -static unsigned long num_ccpair = 0; +static unsigned num_clients = 0; +static unsigned num_callbacks = 0; +static unsigned num_ccpair = 0; static Heap *heap_ccpairs = NULL; static PROCESS cleaner_pid; static unsigned debuglevel; +afsUUID server_uuid; + /* * */ @@ -291,12 +303,39 @@ callbacks_hash (void *p) c->fid.Unique; } + +/* + * + */ + +static int +ccpairs_cmp (void *p1, void *p2) +{ + struct ropa_ccpair *c1 = (struct ropa_ccpair *) p1; + struct ropa_ccpair *c2 = (struct ropa_ccpair *) p2; + + return c1->cb - c2->cb + || c1->client - c2->client; +} + +/* + * + */ + +static unsigned +ccpairs_hash (void *p) +{ + struct ropa_ccpair *c = (struct ropa_ccpair *) p; + + return (unsigned) c->client + callbacks_hash (c->cb); +} + /* * */ static int -ccpair_cmp (const void *p1, const void *p2) +ccpair_cmp_time (const void *p1, const void *p2) { struct ropa_ccpair *c1 = (struct ropa_ccpair *) p1; struct ropa_ccpair *c2 = (struct ropa_ccpair *) p2; @@ -312,7 +351,11 @@ static Bool client_inuse_p (struct ropa_client *c) { assert (c); - return c->port == 0 ? FALSE : TRUE ; + if (c->state == ROPAC_FREE) + return FALSE; + if (c->state == ROPAC_DEAD && listemptyp(c->callbacks)) + return FALSE; + return TRUE; } /* @@ -342,17 +385,17 @@ ccpairs_inuse_p (struct ropa_ccpair *cc) */ static void -create_clients (void) +create_clients (unsigned n) { struct ropa_client *c; unsigned long i; - c = malloc (NUM_CLIENTS * sizeof (*c)); + c = malloc (n * sizeof (*c)); if (c == NULL) err (1, "create_clients: malloc"); - memset (c, 0, NUM_CLIENTS * sizeof (*c)); + memset (c, 0, n * sizeof (*c)); - for (i = 0 ; i < NUM_CLIENTS; i++) { + for (i = 0 ; i < n; i++) { #ifdef DIAGNOSTIC c[i].magic = DIAGNOSTIC_CLIENT; { @@ -368,9 +411,10 @@ create_clients (void) if (c[i].callbacks == NULL) err (1, "create_clients: listnew"); c[i].ref = 0; + c[i].state = ROPAC_FREE; c[i].li = listaddtail (lru_clients, &c[i]); } - num_clients += NUM_CLIENTS; + num_clients += n; } /* @@ -378,17 +422,17 @@ create_clients (void) */ static void -create_callbacks (void) +create_callbacks (unsigned n) { struct ropa_cb *c; int i; - c = malloc (NUM_CALLBACKS * sizeof (*c)); + c = malloc (n * sizeof (*c)); if (c == NULL) err (1, "create_callbacks: malloc"); - memset (c, 0, NUM_CALLBACKS * sizeof (*c)); + memset (c, 0, n * sizeof (*c)); - for (i = 0; i < NUM_CALLBACKS ; i++) { + for (i = 0; i < n ; i++) { #ifdef DIAGNOSTIC c[i].magic = DIAGNOSTIC_CALLBACK; #endif @@ -397,31 +441,31 @@ create_callbacks (void) err (1, "create_callbacks: listnew"); c[i].li = listaddtail (lru_callback, &c[i]); } - num_callbacks += NUM_CALLBACKS; + num_callbacks += n; } /* * */ -void -create_ccpairs (void) +static void +create_ccpairs (unsigned n) { struct ropa_ccpair *c; int i; - c = malloc (NUM_CCPAIR * sizeof (*c)); + c = malloc (n * sizeof (*c)); if (c == NULL) err (1, "create_ccpairs: malloc"); - memset (c, 0, NUM_CCPAIR * sizeof (*c)); + memset (c, 0, n * sizeof (*c)); - for (i = 0; i < NUM_CCPAIR ; i++) { + for (i = 0; i < n ; i++) { #ifdef DIAGNOSTIC c[i].magic = DIAGNOSTIC_CCPAIR; #endif c[i].li = listaddtail (lru_ccpair, &c[i]); } - num_ccpair += NUM_CCPAIR; + num_ccpair += n; } /* @@ -471,31 +515,129 @@ clear_addr (struct ropa_addr *addr) addr->subnetmask = 0; addr->mtu = 0; } + /* - * + * Update `c' with new host information. */ static void -client_deref (struct ropa_client *c) +client_update_interfaces (struct ropa_client *c, u_int32_t host, + u_int16_t port, interfaceAddr *addr) { - int i, ret; + int i; + int found_addr = 0; - c->ref--; + if (addr->numberOfInterfaces > AFS_MAX_INTERFACE_ADDR) + addr->numberOfInterfaces = AFS_MAX_INTERFACE_ADDR; + + for (i = 0; i < c->numberOfInterfaces; i++) { + hashtabdel (ht_clients_ip, &c->addr[i]); + DIAGNOSTIC_CHECK_ADDR(&c->addr[i]); + } + + for (i = 0; i < addr->numberOfInterfaces; i++) { + DIAGNOSTIC_CHECK_ADDR(&c->addr[i]); + c->addr[i].c = c; + c->addr[i].addr_in = addr->addr_in[i]; + c->addr[i].subnetmask = addr->subnetmask[i]; + c->addr[i].mtu = addr->mtu[i]; + hashtabadd (ht_clients_ip, &c->addr[i]); + if (host == addr->addr_in[i]) + found_addr = 1; + } + if (!found_addr && i < AFS_MAX_INTERFACE_ADDR) { + DIAGNOSTIC_CHECK_ADDR(&c->addr[i]); + c->addr[i].c = c; + c->addr[i].addr_in = host; + c->addr[i].subnetmask = 0xffffff00; + c->addr[i].mtu = ROPA_MTU; + hashtabadd (ht_clients_ip, &c->addr[i]); + i++; + } + c->numberOfInterfaces = i; + for (; i < AFS_MAX_INTERFACE_ADDR; i++) + clear_addr (&c->addr[i]); +} + +/* + * Initialize the client `c' with `host'/`port' (or use `addr' if that + * is available). Add the client to hashtables. + * + * Note that this function can be called more then one time on the + * same client to update the address/uuid information. + */ + +static void +client_init (struct ropa_client *c, u_int32_t host, u_int16_t port, + afsUUID *uuid, interfaceAddr *addr) +{ + c->port = port; + if (addr) { + client_update_interfaces (c, host, port, addr); + } else { + int i; - if (c->ref == 0) { - for (i = 0 ; i < c->numberOfInterfaces ; i++) { - int ret = hashtabdel (ht_clients_ip, &c->addr[i]); - assert (ret == 0); - clear_addr (&c->addr[i]); + for (i = 0; i < c->numberOfInterfaces; i++) { + hashtabdel (ht_clients_ip, &c->addr[i]); + DIAGNOSTIC_CHECK_ADDR(&c->addr[i]); } - c->numberOfInterfaces = 0; - c->port = 0; - ret = hashtabdel (ht_clients_uuid, c); - assert (ret == 0); + c->numberOfInterfaces = 1; + DIAGNOSTIC_CHECK_ADDR(&c->addr[0]); + c->addr[0].c = c; + c->addr[0].addr_in = host; + c->addr[0].subnetmask = 0xffffff00; + c->addr[0].mtu = ROPA_MTU; + hashtabadd (ht_clients_ip, &c->addr[0]); + } + if (uuid) { + c->uuid = *uuid; + hashtabadd (ht_clients_uuid, c); + } +} + +/* + * Free client `c' and remove from alla data-structures. + */ + +static void +disconnect_client (struct ropa_client *c) +{ + int ret; + int i; + + assert (c->ref == 0); + + if (c->li) { listdel (lru_clients, c->li); - c->li = listaddtail (lru_clients, c); + c->li = NULL; } + + for (i = 0 ; i < c->numberOfInterfaces ; i++) { + int ret = hashtabdel (ht_clients_ip, &c->addr[i]); + assert (ret == 0); + clear_addr (&c->addr[i]); + } + c->numberOfInterfaces = 0; + c->port = 0; + c->state = ROPAC_FREE; + + ret = hashtabdel (ht_clients_uuid, c); + assert (ret == 0); + c->li = listaddtail (lru_clients, c); +} + +/* + * + */ + +static void +client_deref (struct ropa_client *c) +{ + c->ref--; + + if (c->ref == 0) + disconnect_client (c); } /* @@ -531,44 +673,23 @@ callback_deref (struct ropa_cb *cb) * */ -struct find_client_s { - struct ropa_ccpair *cc; - struct ropa_client *c; -}; - -static Bool -find_client (List *list, Listitem *li, void *arg) -{ - struct find_client_s *fc = (struct find_client_s *)arg; - struct ropa_ccpair *cc = listdata (li); - - mlog_log (MDEBROPA, "\tclient fc->c = 0x%x cc = 0x%x cc->client = 0x%d", - fc->c, cc, cc == NULL ? 0 : cc->client); - if (cc == NULL) - return FALSE; - if (cc->client == fc->c) { - fc->cc = cc; - return TRUE; - } - return FALSE; -} - static struct ropa_ccpair * add_client (struct ropa_cb *cb, struct ropa_client *c) { struct timeval tv; - struct ropa_ccpair *cc; - struct find_client_s fc; + struct ropa_ccpair cckey, *cc; assert (cb && c); - fc.c = c; - fc.cc = NULL; - listiter (cb->ccpairs, find_client, &fc); - if (fc.cc) { - listdel (lru_ccpair, fc.cc->li); - fc.cc->li = listaddhead (lru_ccpair, fc.cc); - return fc.cc; + cckey.client = c; + cckey.cb = cb; + + cc = hashtabsearch (ht_ccpairs, &cckey); + + if (cc) { + listdel (lru_ccpair, cc->li); + cc->li = listaddhead (lru_ccpair, cc); + return cc; } /* The reverse of these are in break_ccpair */ @@ -585,7 +706,6 @@ add_client (struct ropa_cb *cb, struct ropa_client *c) /* XXX do it for real */ gettimeofday(&tv, NULL); cc->expire = tv.tv_sec + 3600; - cc->version += 1; heap_insert (heap_ccpairs, cc, &cc->heap); LWP_NoYieldSignal (heap_ccpairs); @@ -594,6 +714,7 @@ add_client (struct ropa_cb *cb, struct ropa_client *c) cc->client = c; cc->cb = cb; cc->li = listaddhead (lru_ccpair, cc); + hashtabadd (ht_ccpairs, cc); mlog_log (MDEBROPA, "add_client: added %x to callback %x.%x.%x", c->addr[0].addr_in, cb->fid.Volume, cb->fid.Vnode, cb->fid.Unique); @@ -621,7 +742,7 @@ uuid_init_simple (afsUUID *uuid, u_int32_t host) */ static struct ropa_client * -client_query (u_int32_t host, u_int16_t port) +client_query_notalkback (u_int32_t host, u_int16_t port) { struct ropa_client ckey; struct ropa_addr *addr; @@ -641,93 +762,165 @@ client_query (u_int32_t host, u_int16_t port) * */ -#if 0 static struct ropa_client * -uuid_query_simple (u_int32_t host) +obtain_client (void) { - struct ropa_client ckey; - uuid_init_simple (&ckey.uuid, host); - return hashtabsearch (ht_clients_uuid, &ckey); + struct ropa_client *c; + + c = listdeltail (lru_clients); + DIAGNOSTIC_CHECK_CLIENT(c); + c->li = NULL; + if (client_inuse_p (c)) + break_client (c, TRUE); + + if (c->li) { + listdel(lru_clients, c->li); + c->li = NULL; + } + return c; } -#endif /* * */ -static void -client_update_interfaces (struct ropa_client *c, - u_int32_t host, interfaceAddr *addr) +static struct ropa_client * +client_query (u_int32_t host, u_int16_t port) { - int i; - int found_addr = 0; + struct ropa_client *c, *c_new; + int ret; - if (addr->numberOfInterfaces > AFS_MAX_INTERFACE_ADDR) - addr->numberOfInterfaces = AFS_MAX_INTERFACE_ADDR; - - for (i = 0; i < c->numberOfInterfaces; i++) { - hashtabdel (ht_clients_ip, &c->addr[i]); - DIAGNOSTIC_CHECK_ADDR(&c->addr[i]); - } + c = client_query_notalkback(host, port); + if (c == NULL) { + interfaceAddr remote; + struct rx_connection *conn = NULL; - for (i = 0; i < addr->numberOfInterfaces; i++) { - DIAGNOSTIC_CHECK_ADDR(&c->addr[i]); - c->addr[i].c = c; - c->addr[i].addr_in = addr->addr_in[i]; - c->addr[i].subnetmask = addr->subnetmask[i]; - c->addr[i].mtu = addr->mtu[i]; - hashtabadd (ht_clients_ip, &c->addr[i]); - if (host == addr->addr_in[i]) - found_addr = 1; - } - if (!found_addr && i < AFS_MAX_INTERFACE_ADDR) { - DIAGNOSTIC_CHECK_ADDR(&c->addr[i]); - c->addr[i].c = c; - c->addr[i].addr_in = host; - c->addr[i].subnetmask = 0xffffff00; - c->addr[i].mtu = ROPA_MTU; - hashtabadd (ht_clients_ip, &c->addr[i]); - i++; + c = obtain_client(); + assert (c->state == ROPAC_FREE && c->li == NULL); + c->state = ROPAC_LOOKUP_U; + c->flags |= ROPAF_LOOKUP; + client_init (c, host, port, NULL, NULL); + + conn = rx_NewConnection (host, port, CM_SERVICE_ID, + rxnull_NewClientSecurityObject(), + 0); + if (conn == NULL) { + abort(); /* XXX: free c */ + return NULL; + } + retry: + switch (c->state) { + case ROPAC_DEAD: + c->li = listaddtail (lru_clients, c); + ret = ENETDOWN; + break; + case ROPAC_LOOKUP_U: + ret = RXAFSCB_WhoAreYou (conn, &remote); + if (ret == RXGEN_OPCODE) { + c->state = ROPAC_LOOKUP; + goto retry; + } else if (ret == RX_CALL_DEAD) { + c->state = ROPAC_DEAD; + goto retry; + } else { + struct ropa_client ckey; + + ckey.uuid = remote.uuid; + c_new = hashtabsearch (ht_clients_uuid, &ckey); + if (c_new == NULL) { + client_init (c, host, port, &remote.uuid, NULL); + ret = RXAFSCB_InitCallBackState3(conn, &server_uuid); + } else { + client_update_interfaces (c_new, host, port, &remote); + disconnect_client (c); + c = c_new; + listdel(lru_clients, c->li); + c->li = NULL; + } + } + break; + case ROPAC_LOOKUP: { + afsUUID uuid; + ret = RXAFSCB_InitCallBackState(conn); + if (ret == RX_CALL_DEAD) { + c->state = ROPAC_DEAD; + goto retry; + } + uuid_init_simple (&uuid, host); + client_init (c, host, port, &uuid, NULL); + break; + } + default: + abort(); + } + + rx_DestroyConnection (conn); + + if ((c->flags & ROPAF_WAITING) != 0) + LWP_NoYieldSignal (c); + c->flags &= ~(ROPAF_LOOKUP|ROPAF_WAITING); + + if (ret) { + assert (c->li != NULL); + return NULL; + } + + assert (c->li == NULL); + c->li = listaddhead (lru_clients, c); + + } else { /* c != NULL */ + if ((c->flags & ROPAF_LOOKUP) != 0) { + c->flags |= ROPAF_WAITING; + LWP_WaitProcess (c); + } + assert (c->li != NULL); } - c->numberOfInterfaces = i; - for (; i < AFS_MAX_INTERFACE_ADDR; i++) - clear_addr (&c->addr[i]); + + return c; } /* * */ +#if 0 +static struct ropa_client * +uuid_query_simple (u_int32_t host) +{ + struct ropa_client ckey; + uuid_init_simple (&ckey.uuid, host); + return hashtabsearch (ht_clients_uuid, &ckey); +} +#endif + +/* + * Update `callback' of `type' to expire at `time'. + */ + static void -client_init (struct ropa_client *c, u_int32_t host, u_int16_t port, - afsUUID *uuid, interfaceAddr *addr) +update_callback_time (int32_t time, AFSCallBack *callback, int32_t type) { - assert (c->numberOfInterfaces == 0); + callback->CallBackVersion = CALLBACK_VERSION; + callback->ExpirationTime = time; + callback->CallBackType = type; +} - c->ref = 0; - c->port = port; - if (addr) { - client_update_interfaces (c, host, addr); - } else { - c->numberOfInterfaces = 1; - DIAGNOSTIC_CHECK_ADDR(&c->addr[0]); - c->addr[0].c = c; - c->addr[0].addr_in = host; - c->addr[0].subnetmask = 0xffffff00; - c->addr[0].mtu = ROPA_MTU; - hashtabadd (ht_clients_ip, &c->addr[0]); - } - if (uuid) { - c->uuid = *uuid; - } else { - uuid_init_simple (&c->uuid, host); - } - hashtabadd (ht_clients_uuid, c); +/* + * Update the `callback' of `type' from `cc'. + */ +static void +update_callback (struct ropa_ccpair *cc, AFSCallBack *callback, int32_t type) +{ + struct timeval tv; + gettimeofday(&tv, NULL); + update_callback_time (cc->expire - tv.tv_sec, callback, type); } + /* - * XXX race + * ropa_getcallback will obtain a callback for the socketpair + * `host'/`port' and `fid', then result is returned in `callback'. */ int @@ -737,100 +930,26 @@ ropa_getcallback (u_int32_t host, u_int16_t port, const struct AFSFid *fid, struct ropa_client *c; struct ropa_cb cbkey, *cb; struct ropa_ccpair *cc ; - int ret; debug_print_callbacks(); c = client_query (host, port); if (c == NULL) { - interfaceAddr remote; - struct rx_connection *conn; - - conn = rx_NewConnection (host, port, CM_SERVICE_ID, - rxnull_NewClientSecurityObject(), - 0); - - ret = RXAFSCB_WhoAreYou (conn, &remote); - - /* XXX race, entry can be found, and inserted by other thread */ - - if (ret == RX_CALL_DEAD) { - rx_DestroyConnection (conn); - return ENETDOWN; - } else if (ret == RXGEN_OPCODE) { - /* - * This is an new client that doen't support WhoAreYou. - * Lets add it after a InitCallbackState - */ - - ret = RXAFSCB_InitCallBackState(conn); - /* XXX race, entry can be found, and inserted by other thread */ - rx_DestroyConnection (conn); - if (ret) - return ret; - - c = listdeltail (lru_clients); - DIAGNOSTIC_CHECK_CLIENT(c); - c->li = NULL; - if (client_inuse_p (c)) - break_client (c, TRUE); - /* XXX race, entry can be found, and inserted by other thread */ - - client_init (c, host, port, NULL, NULL); - - c->li = listaddhead (lru_clients, c); - - } else if (ret == 0) { - struct ropa_client ckey; - ckey.uuid = remote.uuid; - c = hashtabsearch (ht_clients_uuid, &ckey); - if (c == NULL) { - afsUUID uuid; - - /* - * This is a new clint that support WhoAreYou - * Lets add it after a InitCallbackState3. - */ - - c = listdeltail (lru_clients); - DIAGNOSTIC_CHECK_CLIENT(c); - if (client_inuse_p (c)) - break_client (c, TRUE); - /* XXX race, entry can be found, and inserted by other thread */ - - ret = RXAFSCB_InitCallBackState3 (conn, &uuid); - rx_DestroyConnection (conn); - if (ret != 0) { - c->li = listaddtail (lru_clients, c); - return ENETDOWN; - } - /* XXX race, entry can be found, and inserted by other thread */ - /* XXX check uuid */ - - client_init (c, host, port, &remote.uuid, &remote); - c->li = listaddhead (lru_clients, c); - - mlog_log (MDEBROPA, "ropa_getcb: new client %x:%x", c, host); - } else { - /* - * We didn't find the client in the ip-hash, but the - * uuid hash, it have changed addresses. XXX If it's a bad - * client, break outstanding callbacks. - */ - - client_update_interfaces (c, host, &remote); + mlog_log (MDEBROPA, "ropa_getcallback: didn't find client %x/%d", + host, port); + update_callback_time (DEFAULT_TIMEOUT, callback, CBSHARED); + return 0; + } - mlog_log (MDEBROPA, "ropa_getcb: updated %x", c); + /* + * At this point the client should be firmly set + * in the ropa client database. + */ #if 0 - if (c->have_outstanding_callbacks) - break_outstanding_callbacks (c); + if (c->have_outstanding_callbacks) + break_outstanding_callbacks (c); #endif - } - } else { - return ENETDOWN; /* XXX some unknown error */ - } - } cbkey.fid = *fid; @@ -863,9 +982,7 @@ ropa_getcallback (u_int32_t host, u_int16_t port, const struct AFSFid *fid, callback_deref (cb); - callback->CallBackVersion = cc->version; - callback->ExpirationTime = cc->expire; - callback->CallBackType = CBSHARED; + update_callback (cc, callback, CBSHARED); debug_print_callbacks(); @@ -879,28 +996,37 @@ ropa_getcallback (u_int32_t host, u_int16_t port, const struct AFSFid *fid, static int notify_client (struct ropa_client *c, AFSCBFids *fids, AFSCBs *cbs) { - struct rx_connection *conn; - u_int16_t port = c->port; +#ifdef NO_CALLBACKS + return 0; +#else int i, ret; - + if (c->conn) { + ret = RXAFSCB_CallBack (c->conn, fids, cbs); + if (ret == 0) + return ret; + } for (i = 0; i < c->numberOfInterfaces ; i++) { + u_int16_t port = c->port; DIAGNOSTIC_CHECK_ADDR(&c->addr[i]); - conn = rx_NewConnection (c->addr[i].addr_in, + + c->conn = rx_NewConnection (c->addr[i].addr_in, port, CM_SERVICE_ID, rxnull_NewClientSecurityObject(), 0); mlog_log (MDEBROPA, "notify_client: notifying %x", c->addr[i].addr_in); - ret = RXAFSCB_CallBack (conn, fids, cbs); - rx_DestroyConnection (conn); - if (ret == 0) + ret = RXAFSCB_CallBack (c->conn, fids, cbs); + if (ret) + rx_DestroyConnection (c->conn); + else break; /* XXX warn */ } return ret; +#endif } /* @@ -914,6 +1040,7 @@ break_ccpair (struct ropa_ccpair *cc, Bool notify_clientp) { AFSCBFids fids; AFSCBs cbs; + int ret; debug_print_callbacks(); @@ -923,15 +1050,9 @@ break_ccpair (struct ropa_ccpair *cc, Bool notify_clientp) listdel (lru_ccpair, cc->li); if (notify_clientp) { - AFSCallBack callback; - callback.CallBackVersion = cc->version; - callback.ExpirationTime = cc->expire; - callback.CallBackType = CBDROPPED; - fids.len = 1; fids.val = &cc->cb->fid; - cbs.len = 1; - cbs.val = &callback; + cbs.len = 0; notify_client (cc->client, &fids, &cbs); } @@ -941,12 +1062,15 @@ break_ccpair (struct ropa_ccpair *cc, Bool notify_clientp) } /* The reverse of these are in add_client */ + ret = hashtabdel (ht_ccpairs, cc); + assert (ret == 0); client_deref (cc->client); cc->client = NULL; callback_deref (cc->cb); cc->cb = NULL; heap_remove (heap_ccpairs, cc->heap); + cc->li = listaddtail (lru_ccpair, cc); debug_print_callbacks(); @@ -989,7 +1113,8 @@ break_ccpairs (struct ropa_client *c, Bool notify_clientp) cbs.val = NULL; cbs.len = 0; - callback.CallBackType = CBDROPPED; + update_callback (cc, &callback, CBDROPPED); + while ((cc = listdeltail (c->callbacks)) != NULL) { DIAGNOSTIC_CHECK_CCPAIR(cc); add_to_cb (&cc->cb->fid, &callback, &fids, &cbs); @@ -1053,24 +1178,23 @@ ropa_break_callback (u_int32_t addr, u_int16_t port, { struct ropa_client *c = NULL; struct ropa_cb cbkey, *cb; - + debug_print_callbacks(); - - c = client_query (addr, port); + + c = client_query_notalkback (addr, port); if (c == NULL) { - /* XXX warn */ - mlog_log (MDEBROPA, "ropa_break_callback: didn't find client %x", addr); -/* return; - XXX really no need to return, right? */ + mlog_log (MDEBROPA, "ropa_break_callback: didn't find client %x/%d", + addr, addr); + return; } cbkey.fid = *fid; cb = hashtabsearch (ht_callbacks, &cbkey); if (cb == NULL) { - /* XXX warn */ - mlog_log (MDEBROPA, "ropa_break_callback: didn't find callback %x.%x.%x:%x", - fid->Volume, fid->Vnode, fid->Unique, addr); + mlog_log (MDEBROPA, "ropa_break_callback: " + "didn't find callback %x.%x.%x:%x/%d", + fid->Volume, fid->Vnode, fid->Unique, addr, port); return; } @@ -1089,47 +1213,39 @@ ropa_drop_callbacks (u_int32_t addr, u_int16_t port, { struct ropa_client *c; struct ropa_cb cbkey, *cb; - struct find_client_s fc; + struct ropa_ccpair cckey, *cc; int i; debug_print_callbacks(); - if (a_cbfids_p->len > AFSCBMAX) { -/* || a_cbfids_p->len > a_cbs_p->len) */ - abort(); + if (a_cbfids_p->len > AFSCBMAX) return EINVAL; - } c = client_query (addr, port); if (c == NULL) { - /* XXX warn */ - return EINVAL; + mlog_log (MDEBROPA, "ropa_drop_callbacks: didn't find client %x/%d", + addr, port); + return 0; } for (i = 0; i < a_cbfids_p->len; i++) { cbkey.fid = a_cbfids_p->val[i]; cb = hashtabsearch (ht_callbacks, &cbkey); - if (cb == NULL) { - /* XXX warn */ -/* return EINVAL; not necessary? */ - } else { - /* XXX check version */ + if (cb != NULL) { + cckey.client = c; + cckey.cb = cb; - fc.c = c; - fc.cc = NULL; - listiter (cb->ccpairs, find_client, &fc); - if (fc.cc == NULL) { - /* XXX warn */ -/* return EINVAL; not necessary? */ - } else { - mlog_log (MDEBROPA, "ropa_drop: dropping %x.%x.%x:%x", - cb->fid.Volume, cb->fid.Vnode, cb->fid.Unique, addr); - break_ccpair (fc.cc, FALSE); + cc = hashtabsearch (ht_ccpairs, &cckey); + if (cc != NULL) { + mlog_log (MDEBROPA, "ropa_drop: dropping %x.%x.%x:%x/%d", + cb->fid.Volume, cb->fid.Vnode, cb->fid.Unique, + addr, port); + break_ccpair (cc, FALSE); } } } - + debug_print_callbacks(); return 0; @@ -1203,20 +1319,26 @@ heapcleaner (char *arg) */ int -ropa_init (unsigned long num_callback, unsigned long num_clients) +ropa_init (unsigned num_cb, unsigned num_cli, unsigned num_cc, + unsigned hashsz_cb, unsigned hashsz_cli, unsigned hashsz_cc) { - ht_callbacks = hashtabnew (num_callback, callbacks_cmp, callbacks_hash); + ht_callbacks = hashtabnew (hashsz_cb, callbacks_cmp, callbacks_hash); if (ht_callbacks == NULL) errx (1, "ropa_init: failed to create hashtable for callbacks"); - ht_clients_ip = hashtabnew (num_clients, clients_cmp_ip, clients_hash_ip); + ht_clients_ip = hashtabnew (hashsz_cli, clients_cmp_ip, clients_hash_ip); if (ht_clients_ip == NULL) errx (1, "ropa_init: failed to create hashtable for clients_ip"); - ht_clients_uuid = hashtabnew (num_clients, clients_cmp_uuid, + ht_clients_uuid = hashtabnew (hashsz_cli, clients_cmp_uuid, clients_hash_uuid); if (ht_clients_uuid == NULL) errx (1, "ropa_init: failed to create hashtable for clients_uuid"); + + ht_ccpairs = hashtabnew (hashsz_cc, ccpairs_cmp, + ccpairs_hash); + if (ht_ccpairs == NULL) + errx (1, "ropa_init: failed to create hashtable for ccpairs"); lru_clients = listnew (); if (lru_clients == NULL) @@ -1230,13 +1352,15 @@ ropa_init (unsigned long num_callback, unsigned long num_clients) if (lru_callback == NULL) errx (1, "ropa_init: failed to create list for callback"); - heap_ccpairs = heap_new (NUM_CCPAIR, ccpair_cmp); + heap_ccpairs = heap_new (num_cc, ccpair_cmp_time); if (heap_ccpairs == NULL) errx (1, "ropa_init: failed to create heap for ccpairs"); - create_clients(); - create_callbacks(); - create_ccpairs(); + create_clients(num_cli); + create_callbacks(num_cb); + create_ccpairs(num_cc); + + uuid_init_simple (&server_uuid, 0x82ED305E); if (LWP_CreateProcess (heapcleaner, ROPA_STACKSIZE, 1, NULL, "heap-invalidator", &cleaner_pid)) diff --git a/usr.sbin/afs/src/milko/lib/ropa/ropa.h b/usr.sbin/afs/src/milko/lib/ropa/ropa.h index c553214ce56..96771bfb276 100644 --- a/usr.sbin/afs/src/milko/lib/ropa/ropa.h +++ b/usr.sbin/afs/src/milko/lib/ropa/ropa.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,10 +31,11 @@ * SUCH DAMAGE. */ -/* $Id: ropa.h,v 1.1 2000/09/11 14:41:16 art Exp $ */ +/* $KTH: ropa.h,v 1.8 2000/10/03 00:18:35 lha Exp $ */ int -ropa_init (unsigned long num_callback, unsigned long num_clients); +ropa_init (unsigned num_cb, unsigned num_cli, unsigned num_cc, + unsigned hashsz_cb, unsigned hashsz_cli, unsigned hashsz_cc); int ropa_getcallback (u_int32_t host, u_int16_t port, const struct AFSFid *fid, diff --git a/usr.sbin/afs/src/milko/lib/vld/Makefile.in b/usr.sbin/afs/src/milko/lib/vld/Makefile.in index aad3d808818..f02ff4e9710 100644 --- a/usr.sbin/afs/src/milko/lib/vld/Makefile.in +++ b/usr.sbin/afs/src/milko/lib/vld/Makefile.in @@ -1,10 +1,11 @@ # -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:16 art Exp $ +# $KTH: Makefile.in,v 1.10 2000/10/08 06:23:25 lha Exp $ # SHELL = /bin/sh srcdir = @srcdir@ +top_builddir = ../../.. VPATH = @srcdir@ CC = @CC@ diff --git a/usr.sbin/afs/src/milko/lib/vld/common.c b/usr.sbin/afs/src/milko/lib/vld/common.c index 1443145e6ff..03e905fe2a9 100644 --- a/usr.sbin/afs/src/milko/lib/vld/common.c +++ b/usr.sbin/afs/src/milko/lib/vld/common.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include <sfvol_private.h> -RCSID("$Id: common.c,v 1.1 2000/09/11 14:41:16 art Exp $"); +RCSID("$KTH: common.c,v 1.3 2000/10/03 00:18:41 lha Exp $"); /* * Translate the `opaque' to the `ino'. diff --git a/usr.sbin/afs/src/milko/lib/vld/debug.c b/usr.sbin/afs/src/milko/lib/vld/debug.c index 9848605ade8..f0fde365146 100644 --- a/usr.sbin/afs/src/milko/lib/vld/debug.c +++ b/usr.sbin/afs/src/milko/lib/vld/debug.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include <config.h> -RCSID("$Id: debug.c,v 1.1 2000/09/11 14:41:16 art Exp $"); +RCSID("$KTH: debug.c,v 1.2 2000/10/03 00:18:46 lha Exp $"); #include <sys/types.h> #include <unistd.h> diff --git a/usr.sbin/afs/src/milko/lib/vld/fvol.c b/usr.sbin/afs/src/milko/lib/vld/fvol.c index 6c4617d3fe3..682825fb0f2 100644 --- a/usr.sbin/afs/src/milko/lib/vld/fvol.c +++ b/usr.sbin/afs/src/milko/lib/vld/fvol.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include <sfvol_private.h> -RCSID("$Id: fvol.c,v 1.1 2000/09/11 14:41:16 art Exp $"); +RCSID("$KTH: fvol.c,v 1.3 2000/10/03 00:18:51 lha Exp $"); /* * Description: diff --git a/usr.sbin/afs/src/milko/lib/vld/fvol.h b/usr.sbin/afs/src/milko/lib/vld/fvol.h index a2f59986208..54e8ab78cbd 100644 --- a/usr.sbin/afs/src/milko/lib/vld/fvol.h +++ b/usr.sbin/afs/src/milko/lib/vld/fvol.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -37,7 +32,7 @@ */ /* - * $Id: fvol.h,v 1.1 2000/09/11 14:41:16 art Exp $ + * $KTH: fvol.h,v 1.3 2000/10/03 00:18:56 lha Exp $ */ #define FVOL_MAGIC1 0x1132 diff --git a/usr.sbin/afs/src/milko/lib/vld/glue.c b/usr.sbin/afs/src/milko/lib/vld/glue.c index 1e2d68c0408..b0e116fab4d 100644 --- a/usr.sbin/afs/src/milko/lib/vld/glue.c +++ b/usr.sbin/afs/src/milko/lib/vld/glue.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -65,7 +60,7 @@ #include <err.h> #include <errno.h> -RCSID("$Id: glue.c,v 1.1 2000/09/11 14:41:16 art Exp $"); +RCSID("$KTH: glue.c,v 1.4 2000/10/03 00:19:01 lha Exp $"); /* * diff --git a/usr.sbin/afs/src/milko/lib/vld/mdir.c b/usr.sbin/afs/src/milko/lib/vld/mdir.c index 4db507da085..71cef732762 100644 --- a/usr.sbin/afs/src/milko/lib/vld/mdir.c +++ b/usr.sbin/afs/src/milko/lib/vld/mdir.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -42,7 +37,7 @@ #include <config.h> -RCSID("$Id: mdir.c,v 1.1 2000/09/11 14:41:17 art Exp $"); +RCSID("$KTH: mdir.c,v 1.10 2000/10/03 00:19:06 lha Exp $"); #include <sys/types.h> #include <sys/stat.h> diff --git a/usr.sbin/afs/src/milko/lib/vld/mdir.h b/usr.sbin/afs/src/milko/lib/vld/mdir.h index 13a56aa9d00..ca4031e1b8b 100644 --- a/usr.sbin/afs/src/milko/lib/vld/mdir.h +++ b/usr.sbin/afs/src/milko/lib/vld/mdir.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,13 +31,13 @@ * SUCH DAMAGE. */ -/* $Id: mdir.h,v 1.1 2000/09/11 14:41:17 art Exp $ */ +/* $KTH: mdir.h,v 1.4 2000/10/03 00:19:11 lha Exp $ */ /* * Interface to fdir directory handling routines */ -/* $Id: mdir.h,v 1.1 2000/09/11 14:41:17 art Exp $ */ +/* $KTH: mdir.h,v 1.4 2000/10/03 00:19:11 lha Exp $ */ #ifndef _MDIR_H_ #define _MDIR_H_ diff --git a/usr.sbin/afs/src/milko/lib/vld/mnode.c b/usr.sbin/afs/src/milko/lib/vld/mnode.c index b7cd34c9382..902fc48569a 100644 --- a/usr.sbin/afs/src/milko/lib/vld/mnode.c +++ b/usr.sbin/afs/src/milko/lib/vld/mnode.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -47,7 +42,7 @@ #include <config.h> #endif -RCSID("$Id: mnode.c,v 1.1 2000/09/11 14:41:17 art Exp $"); +RCSID("$KTH: mnode.c,v 1.9 2000/10/03 00:19:17 lha Exp $"); #include <sys/types.h> #include <stdio.h> diff --git a/usr.sbin/afs/src/milko/lib/vld/mnode.h b/usr.sbin/afs/src/milko/lib/vld/mnode.h index 2ecb715fc91..dde362c9d98 100644 --- a/usr.sbin/afs/src/milko/lib/vld/mnode.h +++ b/usr.sbin/afs/src/milko/lib/vld/mnode.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: mnode.h,v 1.1 2000/09/11 14:41:17 art Exp $ */ +/* $KTH: mnode.h,v 1.7 2000/10/03 00:19:22 lha Exp $ */ #ifndef MILKO_MNODE_H #define MILKO_MNODE_H 1 @@ -57,8 +52,7 @@ typedef enum { VOLOP_READ = 0x001, /* read file */ VOLOP_LOCK = 0x020, /* lock file */ VOLOP_ADMIN = 0x040, /* modify bits */ VOLOP_GETSTATUS = 0x080, /* get status */ - VOLOP_PARENT = 0x100, /* this is a parent */ - VOLOP_NOCHECK = 0x200 /* do no check */ + VOLOP_NOCHECK = 0x100 /* do no check */ } volop_flags ; struct mnode { diff --git a/usr.sbin/afs/src/milko/lib/vld/salvage.c b/usr.sbin/afs/src/milko/lib/vld/salvage.c index 03552f3898f..7e4497ddef1 100644 --- a/usr.sbin/afs/src/milko/lib/vld/salvage.c +++ b/usr.sbin/afs/src/milko/lib/vld/salvage.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include <config.h> -RCSID("$Id: salvage.c,v 1.1 2000/09/11 14:41:17 art Exp $"); +RCSID("$KTH: salvage.c,v 1.11 2000/10/03 00:19:27 lha Exp $"); #include <sys/types.h> #include <sys/stat.h> diff --git a/usr.sbin/afs/src/milko/lib/vld/salvage.h b/usr.sbin/afs/src/milko/lib/vld/salvage.h index 11d4f2c1995..e13b96ccf17 100644 --- a/usr.sbin/afs/src/milko/lib/vld/salvage.h +++ b/usr.sbin/afs/src/milko/lib/vld/salvage.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: salvage.h,v 1.1 2000/09/11 14:41:17 art Exp $ */ +/* $KTH: salvage.h,v 1.2 2000/10/03 00:19:33 lha Exp $ */ #ifndef MILKO_SALVAGE_H #define MILKO_SALVAGE_H 1 diff --git a/usr.sbin/afs/src/milko/lib/vld/sfvol_private.h b/usr.sbin/afs/src/milko/lib/vld/sfvol_private.h index 903e1e6dc49..f6b7433a676 100644 --- a/usr.sbin/afs/src/milko/lib/vld/sfvol_private.h +++ b/usr.sbin/afs/src/milko/lib/vld/sfvol_private.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/usr.sbin/afs/src/milko/lib/vld/svol.c b/usr.sbin/afs/src/milko/lib/vld/svol.c index 971365802c9..879c6a3e558 100644 --- a/usr.sbin/afs/src/milko/lib/vld/svol.c +++ b/usr.sbin/afs/src/milko/lib/vld/svol.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include <sfvol_private.h> -RCSID("$Id: svol.c,v 1.1 2000/09/11 14:41:17 art Exp $"); +RCSID("$KTH: svol.c,v 1.3 2000/10/03 00:19:44 lha Exp $"); /* * Description: diff --git a/usr.sbin/afs/src/milko/lib/vld/vld.c b/usr.sbin/afs/src/milko/lib/vld/vld.c index 388db77257f..e8ac96a9017 100644 --- a/usr.sbin/afs/src/milko/lib/vld/vld.c +++ b/usr.sbin/afs/src/milko/lib/vld/vld.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1999 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: vld.c,v 1.1 2000/09/11 14:41:17 art Exp $ */ +/* $KTH: vld.c,v 1.49 2000/12/29 19:45:50 tol Exp $ */ #include <sys/types.h> #include <stdio.h> @@ -75,7 +70,9 @@ int vld_storestatus_to_ent (struct voldb_entry *e, const AFSStoreStatus *ss, struct msec *sec); -static int vld_ent_to_fetchstatus (struct voldb_entry *e, struct mnode *n); +static int vld_ent_to_fetchstatus (struct volume_handle *vol, + struct voldb_entry *e, + struct mnode *n); static void vld_set_author(struct voldb_entry *e, struct msec *m); static int super_user (struct msec *m); @@ -369,7 +366,6 @@ vld_create_entry (volume_handle *vol, struct mnode *parent, AFSFid *child, struct voldb *db; int (*convert_local2afs)(int32_t); node_type ntype; - time_t now; switch (type) { case TYPE_DIR: @@ -427,13 +423,11 @@ vld_create_entry (volume_handle *vol, struct mnode *parent, AFSFid *child, } } - now = time(NULL); - if (type == TYPE_DIR) { e.u.dir.ino = child_ino; e.u.dir.FileType = type; e.u.dir.LinkCount = 2; - e.u.dir.DataVersion = now; + e.u.dir.DataVersion = 0; e.u.dir.ParentVnode = parent->fid.Vnode; e.u.dir.ParentUnique = parent->fid.Unique; memcpy (&e.u.dir.negacl, &parent->e.u.dir.negacl, @@ -444,12 +438,12 @@ vld_create_entry (volume_handle *vol, struct mnode *parent, AFSFid *child, e.u.file.ino = child_ino; e.u.file.FileType = type; e.u.file.LinkCount = 1; - e.u.file.DataVersion = now; + e.u.file.DataVersion = 0; e.u.file.ParentVnode = parent->fid.Vnode; e.u.file.ParentUnique = parent->fid.Unique; } - voldb_update_time(&e, now); + voldb_update_time(&e, time(NULL)); vld_set_author(&e, m); ret = vld_storestatus_to_ent (&e, ss, m); @@ -480,7 +474,7 @@ vld_create_entry (volume_handle *vol, struct mnode *parent, AFSFid *child, n->flags.ep = TRUE; } - ret = vld_ent_to_fetchstatus(&e, n); + ret = vld_ent_to_fetchstatus(vol, &e, n); if (ret) goto out_bad_put; } @@ -580,7 +574,7 @@ vld_adjust_linkcount (volume_handle *vol, struct mnode *n, int adjust) ret = voldb_put_entry (db, real_mnode, &n->e); if (ret) return ret; - + n->fs.LinkCount += adjust; n->flags.ep = TRUE; @@ -945,8 +939,6 @@ vld_create_volume (struct dp_part *dp, int32_t volid, PRSFS_ADMINISTER; parent_n.e.u.dir.acl[1].owner = PR_ANYUSERID; parent_n.e.u.dir.acl[1].flags = PRSFS_LOOKUP | PRSFS_READ; - parent_n.e.u.dir.acl[2].owner = PR_ANONYMOUSID; - parent_n.e.u.dir.acl[2].flags = PRSFS_LOOKUP | PRSFS_READ; ret = vld_create_entry (vol, &parent_n, &child, TYPE_DIR, &ss, &n, NULL); @@ -1110,7 +1102,8 @@ vld_storestatus_to_ent (struct voldb_entry *e, */ static int -vld_dent_to_fetchstatus (struct voldb_dir_entry *e, +vld_dent_to_fetchstatus (struct volume_handle *vol, + struct voldb_dir_entry *e, struct mnode *n) { int ret; @@ -1133,8 +1126,8 @@ vld_dent_to_fetchstatus (struct voldb_dir_entry *e, fs->SegSize = e->SegSize; fs->ClientModTime = e->ServerModTime; fs->ServerModTime = e->ServerModTime; - fs->SyncCount = 4711; - fs->spare1 = 0; + fs->SyncCount = 0; + fs->spare1 = vol->info.creationDate; fs->spare2 = 0; fs->spare3 = 0; fs->spare4 = 0; @@ -1158,7 +1151,8 @@ vld_dent_to_fetchstatus (struct voldb_dir_entry *e, */ static int -vld_fent_to_fetchstatus (struct voldb_file_entry *e, +vld_fent_to_fetchstatus (struct volume_handle *vol, + struct voldb_file_entry *e, struct mnode *n) { int ret; @@ -1181,8 +1175,8 @@ vld_fent_to_fetchstatus (struct voldb_file_entry *e, fs->SegSize = e->SegSize; fs->ClientModTime = e->ServerModTime; fs->ServerModTime = e->ServerModTime; - fs->SyncCount = 4711; - fs->spare1 = 0; + fs->SyncCount = 0; + fs->spare1 = vol->info.creationDate; fs->spare2 = 0; fs->spare3 = 0; fs->spare4 = 0; @@ -1206,7 +1200,9 @@ vld_fent_to_fetchstatus (struct voldb_file_entry *e, */ static int -vld_ent_to_fetchstatus (struct voldb_entry *e, struct mnode *n) +vld_ent_to_fetchstatus (struct volume_handle *vol, + struct voldb_entry *e, + struct mnode *n) { int ret; @@ -1217,11 +1213,11 @@ vld_ent_to_fetchstatus (struct voldb_entry *e, struct mnode *n) switch (e->type) { case TYPE_DIR: - ret = vld_dent_to_fetchstatus (&e->u.dir, n); + ret = vld_dent_to_fetchstatus (vol, &e->u.dir, n); break; case TYPE_FILE: case TYPE_LINK: - ret = vld_fent_to_fetchstatus (&e->u.file, n); + ret = vld_fent_to_fetchstatus (vol, &e->u.file, n); break; default: abort(); @@ -1362,13 +1358,7 @@ vld_check_rights (volume_handle *vol, struct mnode *n, if (m->sec->cps == NULL) return EPERM; - /* - * The root node has itself as parent - */ - - if ((n->fid.Vnode == 1 && n->fid.Unique == 1) - || (m->flags & VOLOP_PARENT) == VOLOP_PARENT) { - assert(n->e.type == TYPE_DIR); + if (n->e.type == TYPE_DIR) { parent_n = n; } else { memset (&pm, 0, sizeof (pm)); @@ -1473,7 +1463,7 @@ vld_open_vnode (volume_handle *vol, struct mnode *n, struct msec *m) n->flags.fdp = TRUE; if ((m->flags & VOLOP_GETSTATUS) == VOLOP_GETSTATUS) - ret = vld_ent_to_fetchstatus (&n->e, n); + ret = vld_ent_to_fetchstatus (vol, &n->e, n); return ret; } @@ -1523,10 +1513,12 @@ vld_modify_vnode (volume_handle *vol, struct mnode *n, struct msec *m, n->sb.st_size = *len; } - if (n->e.type == TYPE_DIR) - n->e.u.dir.DataVersion++; - else - n->e.u.file.DataVersion++; + if (m->flags & (VOLOP_WRITE|VOLOP_INSERT|VOLOP_DELETE)) { + if (n->e.type == TYPE_DIR) + n->e.u.dir.DataVersion++; + else + n->e.u.file.DataVersion++; + } ret = voldb_put_entry (db, real_mnode, &n->e); if (ret) @@ -1534,7 +1526,7 @@ vld_modify_vnode (volume_handle *vol, struct mnode *n, struct msec *m, n->flags.fsp = FALSE; /* Force vld_ent_to_fetchstatus to fill in the field */ - ret = vld_ent_to_fetchstatus (&n->e, n); + ret = vld_ent_to_fetchstatus (vol, &n->e, n); return ret; } @@ -1569,7 +1561,7 @@ vld_put_acl (volume_handle *vol, struct mnode *n, struct msec *m) to fill in the field */ if ((m->flags & VOLOP_GETSTATUS) == VOLOP_GETSTATUS) - ret = vld_ent_to_fetchstatus (&n->e, n); + ret = vld_ent_to_fetchstatus (vol, &n->e, n); return ret; } diff --git a/usr.sbin/afs/src/milko/lib/vld/vld.h b/usr.sbin/afs/src/milko/lib/vld/vld.h index 94a132c0ebe..5f55fe90eb9 100644 --- a/usr.sbin/afs/src/milko/lib/vld/vld.h +++ b/usr.sbin/afs/src/milko/lib/vld/vld.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: vld.h,v 1.1 2000/09/11 14:41:18 art Exp $ */ +/* $KTH: vld.h,v 1.24 2000/10/03 00:19:57 lha Exp $ */ #ifndef MILKO_VLD_H #define MILKO_VLD_H 1 diff --git a/usr.sbin/afs/src/milko/lib/voldb/Makefile.in b/usr.sbin/afs/src/milko/lib/voldb/Makefile.in index b09ed37e004..39d937269c3 100644 --- a/usr.sbin/afs/src/milko/lib/voldb/Makefile.in +++ b/usr.sbin/afs/src/milko/lib/voldb/Makefile.in @@ -1,10 +1,11 @@ # -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:18 art Exp $ +# $KTH: Makefile.in,v 1.8 2000/12/29 20:16:00 tol Exp $ # SHELL = /bin/sh srcdir = @srcdir@ +top_builddir = ../../.. VPATH = @srcdir@ CC = @CC@ @@ -16,6 +17,7 @@ INCLUDES = -I. \ -I$(srcdir)/../../.. \ -I../../../rxdef \ -I../../../include \ + -I$(srcdir)/../dpart \ -I../vstatus \ -I$(srcdir)/../vstatus \ $(KRB4_INC_FLAGS) \ diff --git a/usr.sbin/afs/src/milko/lib/voldb/vdb_flat.c b/usr.sbin/afs/src/milko/lib/voldb/vdb_flat.c index 010694f264d..8fc4fc416ff 100644 --- a/usr.sbin/afs/src/milko/lib/voldb/vdb_flat.c +++ b/usr.sbin/afs/src/milko/lib/voldb/vdb_flat.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -44,7 +39,7 @@ #include "voldb_locl.h" #include "voldb_internal.h" -RCSID("$Id: vdb_flat.c,v 1.1 2000/09/11 14:41:18 art Exp $"); +RCSID("$KTH: vdb_flat.c,v 1.14 2000/10/03 00:20:03 lha Exp $"); static int vdbflat_init (int fd, struct voldb *db, int createp); diff --git a/usr.sbin/afs/src/milko/lib/voldb/vol.c b/usr.sbin/afs/src/milko/lib/voldb/vol.c index 89a98058dd0..ba420b48bf5 100644 --- a/usr.sbin/afs/src/milko/lib/voldb/vol.c +++ b/usr.sbin/afs/src/milko/lib/voldb/vol.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -42,7 +37,7 @@ #include "voldb_locl.h" -RCSID("$Id: vol.c,v 1.1 2000/09/11 14:41:18 art Exp $"); +RCSID("$KTH: vol.c,v 1.6 2000/12/29 20:16:01 tol Exp $"); /* * get the partial name of the volume @@ -76,10 +71,11 @@ vol_getfullname (u_int32_t part, u_int32_t num, char *str, size_t sz) return ret; if (part <= 'z' - 'a') - ret = snprintf (str, sz, "/vicep%c/%s", 'a' + part, volname); + ret = snprintf (str, sz, "%s/vicep%c/%s", + dpart_root, 'a' + part, volname); #if 0 else if (part <= ('z' - 'a') * ('z' - 'a')) - ret = snprintf (str, sz, "/vicep%c%c/%s", + ret = snprintf (str, sz, "%s/vicep%c%c/%s", dpart_root, 'a' + part / ('z' - 'a'), 'a' + part % ('z' - 'a'), volname); diff --git a/usr.sbin/afs/src/milko/lib/voldb/voldb.c b/usr.sbin/afs/src/milko/lib/voldb/voldb.c index dad554e2f70..c68050a77f9 100644 --- a/usr.sbin/afs/src/milko/lib/voldb/voldb.c +++ b/usr.sbin/afs/src/milko/lib/voldb/voldb.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -44,7 +39,7 @@ #include "voldb_locl.h" #include "voldb_internal.h" -RCSID("$Id: voldb.c,v 1.1 2000/09/11 14:41:18 art Exp $"); +RCSID("$KTH: voldb.c,v 1.21 2000/10/03 00:20:13 lha Exp $"); struct voldb_type *voltypes[] = { &vdb_flat, diff --git a/usr.sbin/afs/src/milko/lib/voldb/voldb.h b/usr.sbin/afs/src/milko/lib/voldb/voldb.h index 4f277182ad8..3ad35e8ed33 100644 --- a/usr.sbin/afs/src/milko/lib/voldb/voldb.h +++ b/usr.sbin/afs/src/milko/lib/voldb/voldb.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: voldb.h,v 1.1 2000/09/11 14:41:18 art Exp $ */ +/* $KTH: voldb.h,v 1.17 2000/10/03 00:20:19 lha Exp $ */ #ifndef FILBUNKE_VOLDB_H #define FILBUNKE_VOLDB_H 1 diff --git a/usr.sbin/afs/src/milko/lib/voldb/voldb_internal.h b/usr.sbin/afs/src/milko/lib/voldb/voldb_internal.h index 614a7abea69..9b59459b5dd 100644 --- a/usr.sbin/afs/src/milko/lib/voldb/voldb_internal.h +++ b/usr.sbin/afs/src/milko/lib/voldb/voldb_internal.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/usr.sbin/afs/src/milko/lib/voldb/voldb_locl.h b/usr.sbin/afs/src/milko/lib/voldb/voldb_locl.h index ec6a1c0f8c6..989642850ad 100644 --- a/usr.sbin/afs/src/milko/lib/voldb/voldb_locl.h +++ b/usr.sbin/afs/src/milko/lib/voldb/voldb_locl.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -37,7 +32,7 @@ */ /* - * $Id: voldb_locl.h,v 1.1 2000/09/11 14:41:18 art Exp $ + * $KTH: voldb_locl.h,v 1.4 2000/12/29 20:16:01 tol Exp $ */ #include <config.h> @@ -62,6 +57,7 @@ #include <fs_def.h> #include <fs.h> #include <voldb.h> +#include <dpart.h> #include <volumeserver.h> diff --git a/usr.sbin/afs/src/milko/lib/vstatus/Makefile.in b/usr.sbin/afs/src/milko/lib/vstatus/Makefile.in index 7d4481451bd..53bd7fad20f 100644 --- a/usr.sbin/afs/src/milko/lib/vstatus/Makefile.in +++ b/usr.sbin/afs/src/milko/lib/vstatus/Makefile.in @@ -1,10 +1,11 @@ # -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:19 art Exp $ +# $KTH: Makefile.in,v 1.5 2000/10/08 06:23:39 lha Exp $ # SHELL = /bin/sh srcdir = @srcdir@ +top_builddir = ../../.. VPATH = @srcdir@ CC = @CC@ diff --git a/usr.sbin/afs/src/milko/lib/vstatus/vstat.xg b/usr.sbin/afs/src/milko/lib/vstatus/vstat.xg index bb9484ee9c8..22a492c2fa0 100644 --- a/usr.sbin/afs/src/milko/lib/vstatus/vstat.xg +++ b/usr.sbin/afs/src/milko/lib/vstatus/vstat.xg @@ -16,11 +16,6 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * * 4. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. diff --git a/usr.sbin/afs/src/milko/lib/vstatus/vstatus.c b/usr.sbin/afs/src/milko/lib/vstatus/vstatus.c index e203b16bddb..7fd943bc6a9 100644 --- a/usr.sbin/afs/src/milko/lib/vstatus/vstatus.c +++ b/usr.sbin/afs/src/milko/lib/vstatus/vstatus.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -44,7 +39,7 @@ #include <config.h> -RCSID("$Id: vstatus.c,v 1.1 2000/09/11 14:41:19 art Exp $"); +RCSID("$KTH: vstatus.c,v 1.5 2000/10/03 00:20:35 lha Exp $"); #include <sys/types.h> #include <sys/uio.h> diff --git a/usr.sbin/afs/src/milko/lib/vstatus/vstatus.h b/usr.sbin/afs/src/milko/lib/vstatus/vstatus.h index 0cd0daa4a06..8599cb8da4f 100644 --- a/usr.sbin/afs/src/milko/lib/vstatus/vstatus.h +++ b/usr.sbin/afs/src/milko/lib/vstatus/vstatus.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: vstatus.h,v 1.1 2000/09/11 14:41:19 art Exp $ */ +/* $KTH: vstatus.h,v 1.3 2000/10/03 00:20:40 lha Exp $ */ #ifndef __FILBUNKE_VSTATUS_H #define __FILBUNKE_VSTATUS_H 1 diff --git a/usr.sbin/afs/src/milko/pts/Makefile.in b/usr.sbin/afs/src/milko/pts/Makefile.in index 72b3f76b860..a54a5fda6fc 100644 --- a/usr.sbin/afs/src/milko/pts/Makefile.in +++ b/usr.sbin/afs/src/milko/pts/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:19 art Exp $ +# $KTH: Makefile.in,v 1.10 2000/10/10 20:56:26 lha Exp $ srcdir = @srcdir@ +top_builddir = ../.. VPATH = @srcdir@ CC = @CC@ @@ -38,6 +39,7 @@ INCLUDES = -I$(srcdir)/../.. \ -I$(srcdir)/../../lib/acl \ -I$(srcdir)/../lib/msecurity \ -I../../rxdef \ + @INC_roken@ \ $(RXKADINC) DEFINES = -DDEBUG REALCFLAGS = $(INCLUDES) @KRB4_INC_FLAGS@ $(DEFINES) $(CFLAGS) -DRXDEBUG @@ -50,12 +52,13 @@ LIBS = -L../lib/msecurity -lmsecurity \ -L../../util -lutil \ -L../../rxdef -lptserver -L../../rx -lrx \ -L../../lwp -llwp @PLWP_LIB_FLAGS@ \ - -L../../lib/roken -lroken $(RXKADLIB) \ + $(RXKADLIB) \ $(KAFS_LIBS) \ + @LIB_roken@ \ @LIBS@ LIBDEPENDS = ../../rxdef/librxdefclient.a ../../rx/librx.a \ ../../lwp/liblwp.a ../../util/libutil.a \ - ../../lib/roken/libroken.a ../../lib/ko/libko.a \ + ../../lib/ko/libko.a \ ../lib/voldb/libvoldb.a ../lib/vld/libvld.a \ ../lib/msecurity/libmsecurity.a PROGS = ptserver diff --git a/usr.sbin/afs/src/milko/pts/pr.c b/usr.sbin/afs/src/milko/pts/pr.c index 0b96f0337e1..7a81c70ce34 100644 --- a/usr.sbin/afs/src/milko/pts/pr.c +++ b/usr.sbin/afs/src/milko/pts/pr.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -72,22 +67,26 @@ #include "msecurity.h" -RCSID("$Id: pr.c,v 1.1 2000/09/11 14:41:19 art Exp $"); +RCSID("$KTH: pr.c,v 1.21 2001/01/04 12:06:17 mattiasa Exp $"); + +/* + * + */ -int PR_NameToID(struct rx_call *call, - const namelist *nlist, - idlist *ilist) +int +PR_NameToID(struct rx_call *call, const namelist *nlist, idlist *ilist) { int i; int status; char *localname; - printf("PR_NameToID\n"); -/* printf(" securityIndex: %d\n", call->conn->securityIndex);*/ + pt_debug (PRDB_RPC, "PR_NameToID: securityIndex: %d ilen: %d", + call->conn->securityIndex, nlist->len); + #ifdef KERBEROS if (call->conn->securityIndex == 2) { serv_con_data *cdat = call->conn->securityData; - printf(" user: %s.%s@%s\n", + pt_debug (PRDB_RPC," user: %s.%s@%s", cdat->user->name, cdat->user->instance, cdat->user->realm); @@ -100,7 +99,7 @@ int PR_NameToID(struct rx_call *call, return PRDBBAD; for (i = 0; i < nlist->len; i++) { - printf(" name: %s\n", nlist->val[i]); + pt_debug (PRDB_RPC," name: %s", nlist->val[i]); localname = localize_name(nlist->val[i]); @@ -113,15 +112,18 @@ int PR_NameToID(struct rx_call *call, return 0; } +/* + * + */ + int -PR_IDToName(struct rx_call *call, - const idlist *ilist, - namelist *nlist) +PR_IDToName(struct rx_call *call, const idlist *ilist, namelist *nlist) { int i; int status; - - printf("PR_IDToName\n"); + + pt_debug (PRDB_RPC, "PR_IDToName: securityIndex: %d ilen %d", + call->conn->securityIndex, ilist->len); if (ilist->len < 0 || ilist->len >= PR_MAXLIST) @@ -139,7 +141,7 @@ PR_IDToName(struct rx_call *call, return PRDBBAD; for (i = 0; i < ilist->len; i++) { -/* printf(" id: %d\n", ilist->val[i]);*/ + pt_debug (PRDB_RPC," id: %d", ilist->val[i]); status = conv_id_to_name(ilist->val[i], nlist->val[i]); if (status == PRNOENT) snprintf (nlist->val[i], PR_MAXNAMELEN, "%d", ilist->val[i]); @@ -149,19 +151,19 @@ PR_IDToName(struct rx_call *call, return 0; } -int PR_NewEntry(struct rx_call *call - , const char name[ 64 ] - , const int32_t flag - , const int32_t oid - , int32_t *id - ) +/* + * + */ + +int +PR_NewEntry(struct rx_call *call, const char *name, + const int32_t flag, const int32_t oid, int32_t *id) { int error; char *localname; - printf("PR_NewEntry\n"); - printf(" securityIndex: %d\n", call->conn->securityIndex); - printf(" name:%s oid:%d\n", name, oid); + pt_debug (PRDB_RPC, "PR_NewEntry: securityIndex: %d name: %s oid: %d", + call->conn->securityIndex, name, oid); /* XXX should be authuser? */ @@ -190,12 +192,13 @@ int PR_NewEntry(struct rx_call *call return error; } -int PR_INewEntry( - struct rx_call *call - , const char name[ 64 ] - , const int32_t id - , const int32_t oid - ) +/* + * + */ + +int +PR_INewEntry(struct rx_call *call, const char *name, + const int32_t id, const int32_t oid) { int error; int tempid; @@ -204,9 +207,8 @@ int PR_INewEntry( if (!sec_is_superuser(call)) return PRPERM; - printf("PR_INewEntry\n"); - printf(" securityIndex: %d\n", call->conn->securityIndex); - printf(" name:%s oid:%d\n", name, oid); + pt_debug (PRDB_RPC, "PR_INewEntry securityIndex: %d name: %s oid: %d", + call->conn->securityIndex, name, oid); localname = localize_name(name); if (id > 0) { @@ -228,25 +230,26 @@ int PR_INewEntry( return error; } -int PR_ListEntry( - struct rx_call *call - , const int32_t id - , struct prcheckentry *entry - ) +/* + * + */ + +int +PR_ListEntry(struct rx_call *call, const int32_t id, + struct prcheckentry *entry) { prentry pr_entry; int status; - printf("PR_ListEntry\n"); - printf(" securityIndex: %d\n", call->conn->securityIndex); - printf(" id:%d\n", id); + pt_debug (PRDB_RPC, "PR_ListEntry securityIndex: %d id: %d", + call->conn->securityIndex, id); #ifdef KERBEROS if (call->conn->securityIndex == 2) { serv_con_data *cdat = call->conn->securityData; - printf(" user: %s.%s@%s\n", - cdat->user->name, - cdat->user->instance, - cdat->user->realm); + pt_debug (PRDB_RPC, "PR_ListEntry user: %s.%s@%s", + cdat->user->name, + cdat->user->instance, + cdat->user->realm); } #endif @@ -267,73 +270,78 @@ int PR_ListEntry( return 0; } -int PR_DumpEntry( - struct rx_call *call - , const int32_t pos - , struct prdebugentry *entry - ) +/* + * + */ + +int +PR_DumpEntry(struct rx_call *call, const int32_t pos, + struct prdebugentry *entry) { - printf("PR_DumpEntry\n"); + pt_debug (PRDB_RPC, "PR_DumpEntry"); return -1; } -int PR_ChangeEntry( - struct rx_call *call - , const int32_t id - , const char name[ 64 ] - , const int32_t oid - , const int32_t newid - ) +/* + * + */ + +int +PR_ChangeEntry(struct rx_call *call, const int32_t id, const char *name, + const int32_t oid, const int32_t newid) { - printf("PR_ChangeEntry\n"); + pt_debug (PRDB_RPC, "PR_ChangeEntry"); return -1; } -int PR_SetFieldsEntry( - struct rx_call *call - , const int32_t id - , const int32_t mask - , const int32_t flags - , const int32_t ngroups - , const int32_t nusers - , const int32_t spare1 - , const int32_t spare2 - ) +/* + * + */ + +int +PR_SetFieldsEntry(struct rx_call *call, const int32_t id, const int32_t mask, + const int32_t flags, const int32_t ngroups, + const int32_t nusers, + const int32_t spare1, const int32_t spare2) { - printf("PR_SetFieldsEntry\n"); + pt_debug (PRDB_RPC, "PR_SetFieldsEntry"); return -1; } -int PR_Delete( - struct rx_call *call - , const int32_t id - ) +/* + * + */ + +int +PR_Delete(struct rx_call *call, const int32_t id) { - printf("PR_Delete\n"); + pt_debug (PRDB_RPC, "PR_Delete"); return -1; } -int PR_WhereIsIt( - struct rx_call *call - , const int32_t id - , int32_t *ps - ) +/* + * + */ + +int +PR_WhereIsIt(struct rx_call *call, const int32_t id, int32_t *ps) { - printf("PR_WhereIsIt\n"); + pt_debug (PRDB_RPC, "PR_WhereIsIt"); return -1; } -int PR_AddToGroup( - struct rx_call *call - , const int32_t uid - , const int32_t gid - ) +/* + * + */ + +int +PR_AddToGroup(struct rx_call *call, const int32_t uid, const int32_t gid) { - printf("PR_AddToGroup\n"); + pt_debug (PRDB_RPC, "PR_AddToGroup"); if (!sec_is_superuser(call)) return PRPERM; @@ -342,13 +350,14 @@ int PR_AddToGroup( } -int PR_RemoveFromGroup( - struct rx_call *call - , const int32_t id - , const int32_t gid - ) +/* + * + */ + +int +PR_RemoveFromGroup(struct rx_call *call, const int32_t id, const int32_t gid) { - printf("PR_RemoveFromGroup\n"); + pt_debug (PRDB_RPC, "PR_RemoveFromGroup"); if (!sec_is_superuser(call)) return PRPERM; @@ -357,75 +366,109 @@ int PR_RemoveFromGroup( } -int PR_ListMax( - struct rx_call *call - , int32_t *uid - , int32_t *gid - ) +/* + * + */ + +int +PR_ListMax(struct rx_call *call, int32_t *uid, int32_t *gid) { - printf("PR_ListMax\n"); + pt_debug (PRDB_RPC, "PR_ListMax"); *uid = pr_header.maxID; *gid = pr_header.maxGroup; return 0; } -int PR_SetMax( - struct rx_call *call - , const int32_t uid - , const int32_t gflag - ) +/* + * + */ + +int +PR_SetMax(struct rx_call *call, const int32_t uid, const int32_t gflag) { - printf("PR_SetMax\n"); - return -1; + pt_debug (PRDB_RPC, "PR_SetMax"); + + if(gflag) { + pr_header.maxGroup = uid; + } else { + pr_header.maxID = uid; + } + return 0; } -int PR_ListElements( - struct rx_call *call - , const int32_t id - , prlist *elist - , int32_t *over - ) +/* + * + */ + +int +PR_ListElements(struct rx_call *call, const int32_t id, + prlist *elist, int32_t *over) { - printf("PR_ListElements\n"); + pt_debug (PRDB_RPC, "PR_ListElements"); return listelements(id, elist, FALSE); } -int PR_GetCPS( - struct rx_call *call - , const int32_t id - , prlist *elist - , int32_t *over - ) +/* + * + */ + +int +PR_GetCPS(struct rx_call *call, const int32_t id, + prlist *elist, int32_t *over) { - printf("PR_GetCPS\n"); + pt_debug (PRDB_RPC, "PR_GetCPS"); return listelements(id, elist, TRUE); } -int PR_ListOwned( - struct rx_call *call - , const int32_t id - , prlist *elist - , int32_t *over - ) +/* + * + */ + +int +PR_ListOwned(struct rx_call *call, const int32_t id, + prlist *elist, int32_t *over) { - printf("PR_ListOwned\n"); + pt_debug (PRDB_RPC, "PR_ListOwned"); return -1; } -int PR_IsAMemberOf( - struct rx_call *call - , const int32_t uid - , const int32_t gid - , int32_t *flag - ) +/* + * + */ + +int +PR_IsAMemberOf(struct rx_call *call, const int32_t uid, const int32_t gid, + int32_t *flag) { - printf("PR_IsAMemberOf\n"); - return -1; + + /* XXX Check authorization */ + + prlist elist; + int ret=0; + int i=0; + + pt_debug (PRDB_RPC, "PR_IsAMemberOf"); + + if((ret = listelements(uid, &elist, TRUE)) !=0) { + free(elist.val); + return ret; + } + + for(i=0; i < elist.len ; i++) { + if(elist.val[i] == gid) { + *flag=1; + free(elist.val); + return 0; + } + } + + free(elist.val); + return 0; } diff --git a/usr.sbin/afs/src/milko/pts/ptserver.c b/usr.sbin/afs/src/milko/pts/ptserver.c index cd5a3925aea..6a532afe8d4 100644 --- a/usr.sbin/afs/src/milko/pts/ptserver.c +++ b/usr.sbin/afs/src/milko/pts/ptserver.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -58,7 +53,7 @@ #include <err.h> #include <assert.h> #include <ctype.h> -#include <getarg.h> +#include <agetarg.h> #ifndef HAVE_UNISTD_H #include <unistd.h> @@ -71,7 +66,7 @@ #include "ptserver.h" #include "pts.ss.h" -RCSID("$Id: ptserver.c,v 1.1 2000/09/11 14:41:19 art Exp $"); +RCSID("$KTH: ptserver.c,v 1.36 2000/12/29 19:55:21 tol Exp $"); static struct rx_service *prservice; @@ -79,31 +74,46 @@ static int pr_database = -1; static off_t file_length; prheader pr_header; +static Log_unit *pr_log_unit; +static Log_method *pr_method; + char pr_header_ydr[PRHEADER_SIZE]; +#define all (PRDB_ERROR|PRDB_WARN|PRDB_RPC|PRDB_DB) -static int ptdebug = 0; +struct units pr_deb_units[] = { + { "all", all }, + { "errors", PRDB_ERROR }, +#undef all + { "warnings", PRDB_WARN }, + { "rpc", PRDB_RPC }, + { "db", PRDB_DB }, + { NULL} +}; -int -pt_setdebug (int debug) +void +pt_setdebug (char *debug_level) { - int odebug = ptdebug; - ptdebug = debug; - return odebug; + log_set_mask_str (pr_method, pr_log_unit, debug_level); } +/* + * + */ + void -pt_debug (char *fmt, ...) +pt_debug (unsigned int level, char *fmt, ...) { va_list args; - if (!ptdebug) - return ; va_start (args, fmt); - vfprintf (stderr, fmt, args); + log_vlog (pr_log_unit, level, fmt, args); va_end(args); } +/* + * + */ static void write_header(void) @@ -121,6 +131,10 @@ write_header(void) assert (length == PRHEADER_SIZE); } +/* + * + */ + static void read_header(void) { @@ -140,6 +154,10 @@ read_header(void) err(1, "read_header"); } +/* + * + */ + static void get_file_length(void) { @@ -149,6 +167,9 @@ get_file_length(void) } } +/* + * + */ char * localize_name(const char *name) @@ -159,13 +180,18 @@ localize_name(const char *name) strlcpy(localname, name, sizeof(localname)); strlwr(localname); - if (tmp = strchr(localname, '@')) + tmp = strchr(localname, '@'); + if (tmp) if (!strcasecmp(tmp + 1, netinit_getrealm())) *tmp = '\0'; return localname; } +/* + * + */ + static void create_database(void) { @@ -189,9 +215,37 @@ create_database(void) get_file_length(); } +/* + * + */ + +static int +read_entry(off_t offset, prentry *pr_entry) +{ + off_t pos; + char pr_entry_disk_ydr[PRENTRY_DISK_SIZE]; + int length = PRENTRY_DISK_SIZE; + + pos = lseek(pr_database, offset, SEEK_SET); + assert(pos == offset); + + length = read(pr_database, pr_entry_disk_ydr, PRENTRY_DISK_SIZE); + assert (length == PRENTRY_DISK_SIZE); + + if (ydr_decode_prentry_disk((prentry_disk *) pr_entry, pr_entry_disk_ydr, &length) == NULL) + err(1, "write_entry"); + + return 0; +} + +/* + * + */ + static off_t find_first_free(void) { + prentry pr_entry; off_t pos; if (pr_header.freePtr == 0) { /* if there are no free entries */ @@ -202,12 +256,20 @@ find_first_free(void) err(1, "ftruncate"); return pos; } else { /* there are free entries */ - /* Not implemented yet */ - assert(0); + /* XXX if the caller discards this entry it will become orphaned */ + pos = pr_header.freePtr; + read_entry(pos, &pr_entry); + pr_header.freePtr = pr_entry.next; + write_header(); + return pos; } return 0; } +/* + * + */ + static int write_entry(off_t offset, prentry *pr_entry) { @@ -227,24 +289,9 @@ write_entry(off_t offset, prentry *pr_entry) return 0; } -static int -read_entry(off_t offset, prentry *pr_entry) -{ - off_t pos; - char pr_entry_disk_ydr[PRENTRY_DISK_SIZE]; - int length = PRENTRY_DISK_SIZE; - - pos = lseek(pr_database, offset, SEEK_SET); - assert(pos == offset); - - length = read(pr_database, pr_entry_disk_ydr, PRENTRY_DISK_SIZE); - assert (length == PRENTRY_DISK_SIZE); - - if (ydr_decode_prentry_disk((prentry_disk *) pr_entry, pr_entry_disk_ydr, &length) == NULL) - err(1, "write_entry"); - - return 0; -} +/* + * + */ static unsigned long get_id_hash(long id) @@ -252,6 +299,10 @@ get_id_hash(long id) return ((unsigned long) id) % HASHSIZE; } +/* + * + */ + static unsigned long get_name_hash(const char *name) { @@ -264,14 +315,18 @@ get_name_hash(const char *name) return hash % HASHSIZE; } +/* + * + */ + static int get_first_id_entry(unsigned long hash_id, prentry *pr_entry) { off_t offset = pr_header.idHash[hash_id]; int status; - pt_debug ("get_first_id_entry hash_id: %lu offset: %ld\n", - hash_id, (long)offset); + pt_debug (PRDB_DB, "get_first_id_entry hash_id: %lu offset: %ld", + hash_id, (long)offset); if (offset == 0) return PRNOENT; @@ -280,14 +335,18 @@ get_first_id_entry(unsigned long hash_id, prentry *pr_entry) return status; } +/* + * + */ + static int get_first_name_entry(unsigned long hash_name, prentry *pr_entry) { off_t offset = pr_header.nameHash[hash_name]; int status; - pt_debug ("get_first_name_entry hash_name: %lu offset: %ld\n", - hash_name, (long)offset); + pt_debug (PRDB_DB, "get_first_name_entry hash_name: %lu offset: %ld", + hash_name, (long)offset); if (offset == 0) return PRNOENT; @@ -296,6 +355,10 @@ get_first_name_entry(unsigned long hash_name, prentry *pr_entry) return status; } +/* + * + */ + static int update_entry(prentry *pr_entry) { @@ -304,7 +367,7 @@ update_entry(prentry *pr_entry) unsigned long hash_id; prentry old_pr_entry; - fprintf(stderr, "update_entry\n"); + pt_debug (PRDB_DB, "update_entry"); hash_id = get_id_hash(pr_entry->id); @@ -324,6 +387,10 @@ update_entry(prentry *pr_entry) return write_entry(offset, pr_entry); } +/* + * + */ + static int insert_entry(prentry *pr_entry) { @@ -360,6 +427,10 @@ insert_entry(prentry *pr_entry) return 0; } +/* + * + */ + int create_group(const char *name, int32_t id, @@ -383,6 +454,10 @@ create_group(const char *name, return 0; } +/* + * + */ + int create_user(const char *name, int32_t id, @@ -406,18 +481,25 @@ create_user(const char *name, return 0; } +/* + * + */ + int -addtogroup (int32_t uid, int32_t gid) { +addtogroup (int32_t uid, int32_t gid) +{ prentry uid_entry; prentry gid_entry; - int error,i; + int error, i; - fprintf(stderr, "addtogroup\n"); + pt_debug (PRDB_DB, "addtogroup"); - if (error = get_pr_entry_by_id(uid, &uid_entry)) + error = get_pr_entry_by_id(uid, &uid_entry); + if (error) return error; - if (error = get_pr_entry_by_id(gid, &gid_entry)) + error = get_pr_entry_by_id(gid, &gid_entry); + if (error) return error; /* XXX should allocate contentry block */ @@ -426,12 +508,37 @@ addtogroup (int32_t uid, int32_t gid) { return PRNOENT; assert (uid_entry.entries[uid_entry.count] == 0); - uid_entry.entries[uid_entry.count] = gid; - uid_entry.count++; + + for (i = 0; i < uid_entry.count; i++) + if (uid_entry.entries[i] == gid) + break; + + if (i == uid_entry.count) { + if (uid_entry.count < PRSIZE - 1) { + uid_entry.entries[uid_entry.count] = gid; + uid_entry.count++; + } else + return PRNOENT; + } assert (gid_entry.entries[gid_entry.count] == 0); - gid_entry.entries[gid_entry.count] = uid; - gid_entry.count++; + + for (i = 0; i < gid_entry.count; i++) + if (gid_entry.entries[i] == uid) + break; + + if (i == gid_entry.count) { + if (gid_entry.count < PRSIZE - 1) { + gid_entry.entries[gid_entry.count] = uid; + gid_entry.count++; + } else { + if (uid_entry.entries[uid_entry.count - 1] == gid) { + uid_entry.entries[uid_entry.count - 1] = 0; + uid_entry.count--; + } + return PRNOENT; + } + } if ((error = update_entry(&uid_entry)) != 0) return error; @@ -442,18 +549,26 @@ addtogroup (int32_t uid, int32_t gid) { return 0; } + +/* + * + */ + int -removefromgroup (int32_t uid, int32_t gid) { +removefromgroup (int32_t uid, int32_t gid) +{ prentry uid_entry; prentry gid_entry; - int error, i, offset; + int error, i; - fprintf(stderr, "removefromgroup\n"); + pt_debug (PRDB_DB, "removefromgroup"); - if (error = get_pr_entry_by_id(uid, &uid_entry)) + error = get_pr_entry_by_id(uid, &uid_entry); + if (error) return error; - if (error = get_pr_entry_by_id(gid, &gid_entry)) + error = get_pr_entry_by_id(gid, &gid_entry); + if (error) return error; /* XXX No check for full list */ @@ -496,38 +611,50 @@ removefromgroup (int32_t uid, int32_t gid) { } +/* + * + */ + int listelements (int32_t id, prlist *elist, Bool default_id_p) { prentry pr_entry; int i = 0, error; - if (error = get_pr_entry_by_id (id, &pr_entry)) + error = get_pr_entry_by_id (id, &pr_entry); + if (error) return error; + if(default_id_p) + elist->len = pr_entry.count + 3; + else + elist->len = pr_entry.count; + elist->val = malloc(sizeof(*elist->val) - * (pr_entry.count + (default_id_p ? 3 : 1))); + * (pr_entry.count + elist->len)); if (elist->val == NULL) return ENOMEM; /* XXX */ - + /* XXX contentry blocks... */ /* XXX should be sorted */ for (i = 0; i < pr_entry.count; i++) elist->val[i] = pr_entry.entries[i]; - elist->val[i] = id; if (default_id_p) { + elist->val[i] = id; elist->val[++i] = PR_ANYUSERID; elist->val[++i] = PR_AUTHUSERID; elist->len = pr_entry.count + 3; - } else - elist->len = pr_entry.count + 1; + } return 0; } +/* + * + */ int get_pr_entry_by_id(int id, prentry *pr_entry) @@ -535,10 +662,11 @@ get_pr_entry_by_id(int id, prentry *pr_entry) unsigned long hash_id = get_id_hash(id); int status; - pt_debug ("get_pr_entry_by_id id:%d hash_id: %ld\n", id, hash_id); + pt_debug (PRDB_DB, "get_pr_entry_by_id id:%d hash_id: %ld", + id, hash_id); status = get_first_id_entry(hash_id, pr_entry); - pt_debug ("get_pr_entry_by_id status:%d\n", status); + pt_debug (PRDB_DB, "get_pr_entry_by_id status:%d", status); if (status) return PRNOENT; @@ -548,14 +676,17 @@ get_pr_entry_by_id(int id, prentry *pr_entry) status = read_entry(pr_entry->nextID, pr_entry); } - pt_debug ("pr_entry->id: %d\n", pr_entry->id); - pt_debug ("pr_entry->owner: %d\n", pr_entry->owner); - pt_debug ("pr_entry->creator: %d\n", pr_entry->creator); - pt_debug ("pr_entry->name: %s\n", pr_entry->name); + pt_debug (PRDB_DB, "entry_by_name id: %d owner: %d creator: %d name: %s", + pr_entry->id, pr_entry->owner, + pr_entry->creator, pr_entry->name); return 0; } +/* + * + */ + int get_pr_entry_by_name(const char *name, prentry *pr_entry) { @@ -572,14 +703,17 @@ get_pr_entry_by_name(const char *name, prentry *pr_entry) status = read_entry(pr_entry->nextName, pr_entry); } - fprintf(stderr, " pr_entry->id: %d\n", pr_entry->id); - fprintf(stderr, " pr_entry->owner: %d\n", pr_entry->owner); - fprintf(stderr, " pr_entry->creator: %d\n", pr_entry->creator); - fprintf(stderr, " pr_entry->name: %s\n", pr_entry->name); + pt_debug (PRDB_DB, "entry_by_name id: %d owner: %d creator: %d name: %s", + pr_entry->id, pr_entry->owner, + pr_entry->creator, pr_entry->name); return 0; } +/* + * + */ + int conv_name_to_id(const char *name, int *id) { @@ -593,6 +727,10 @@ conv_name_to_id(const char *name, int *id) return 0; } +/* + * + */ + int conv_id_to_name(int id, char *name) { @@ -606,6 +744,10 @@ conv_id_to_name(int id, char *name) return 0; } +/* + * + */ + int next_free_group_id(void) { @@ -614,6 +756,10 @@ next_free_group_id(void) return pr_header.maxGroup; } +/* + * + */ + int next_free_user_id() { @@ -622,7 +768,6 @@ next_free_user_id() return pr_header.maxID; } - /* * Open the pr database that lives in ``databaseprefix'' * with open(2) ``flags''. Returns 0 or errno. @@ -647,6 +792,10 @@ open_db(char *databaseprefix, int flags) return 0; } +/* + * + */ + static int prserver_create(char *databaseprefix) { @@ -679,6 +828,10 @@ prserver_create(char *databaseprefix) return 0; } +/* + * + */ + static int prserver_init(char *databaseprefix) { @@ -695,31 +848,41 @@ prserver_init(char *databaseprefix) return 0; } +/* + * + */ + static char *cell = NULL; static char *realm = NULL; static char *databasedir = NULL; static char *srvtab_file = NULL; +static char *log_file = "syslog"; +static char *debug_level = NULL; static int no_auth = 0; static int do_help = 0; -static int do_debug = 0; static int do_create = 0; -static struct getargs args[] = { - {"create", 0, arg_flag, &do_create, "create new databas"}, - {"cell", 0, arg_string, &cell, "what cell to use"}, - {"realm", 0, arg_string, &realm, "what realm to use"}, - {"prefix",'p', arg_string, &databasedir, "what dir to store the db"}, - {"noauth", 0, arg_flag, &no_auth, "disable authentication checks"}, - {"srvtab",'s', arg_string, &srvtab_file, "what srvtab to use"}, - {"debug", 'd', arg_flag, &do_debug, "enable debug messages"}, - {"help", 'h', arg_flag, &do_help, "help"}, - { NULL, 0, arg_end, NULL } +static struct agetargs args[] = { + {"create", 0, aarg_flag, &do_create, "create new databas"}, + {"cell", 0, aarg_string, &cell, "what cell to use"}, + {"realm", 0, aarg_string, &realm, "what realm to use"}, + {"prefix",'p', aarg_string, &databasedir, "what dir to store the db"}, + {"noauth", 0, aarg_flag, &no_auth, "disable authentication checks"}, + {"srvtab",'s', aarg_string, &srvtab_file, "what srvtab to use"}, + {"debug", 'd',aarg_string, &debug_level, "enable debug messages"}, + {"log", 'l', aarg_string, &log_file, "log file"}, + {"help", 'h', aarg_flag, &do_help, "help"}, + { NULL, 0, aarg_end, NULL } }; +/* + * + */ + static void usage(int exit_code) { - arg_printusage(args, NULL, "", ARG_AFSSTYLE); + aarg_printusage(args, NULL, "", AARG_AFSSTYLE); exit (exit_code); } @@ -730,10 +893,12 @@ usage(int exit_code) int main(int argc, char **argv) { - int ret; int optind = 0; + int ret; - if (getarg (args, argc, argv, &optind, ARG_AFSSTYLE)) { + set_progname (argv[0]); + + if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) { usage (1); } @@ -741,15 +906,24 @@ main(int argc, char **argv) argv += optind; if (argc) { - printf("unknown option %s\n", *argv); + printf("unknown option %s", *argv); return 1; } if (do_help) usage(0); - if (do_debug) - pt_setdebug (1); + pr_method = log_open (get_progname(), log_file); + if (pr_method == NULL) + errx (1, "log_open failed"); + + pr_log_unit = log_unit_init (pr_method, "arla", pr_deb_units, + PR_DEFAULT_LOG); + if (pr_log_unit == NULL) + errx (1, "log_unit_init failed"); + + if (debug_level) + pt_setdebug (debug_level); if (do_create) { prserver_create (databasedir); @@ -759,10 +933,10 @@ main(int argc, char **argv) if (no_auth) sec_disable_superuser_check (); - printf ("ptserver booting\n"); - + cell_init(0, pr_method); ports_init(); - cell_init(0); + + printf ("ptserver booting"); if (cell) cell_setthiscell (cell); @@ -771,14 +945,14 @@ main(int argc, char **argv) ret = prserver_init(databasedir); if (ret) - errx (1, "prserver_init: error %d\n", ret); + errx (1, "prserver_init: error %d", ret); ret = network_init(htons(afsprport), "pr", PR_SERVICE_ID, - PR_ExecuteRequest, &prservice, NULL); + PR_ExecuteRequest, &prservice, realm); if (ret) errx (1, "network_init returned %d", ret); - printf("started\n"); + pt_debug (PRDB_WARN, "started"); rx_SetMaxProcs(prservice,5) ; rx_StartServer(1) ; diff --git a/usr.sbin/afs/src/milko/pts/ptserver.h b/usr.sbin/afs/src/milko/pts/ptserver.h index 95c66f96de5..ba06fa53699 100644 --- a/usr.sbin/afs/src/milko/pts/ptserver.h +++ b/usr.sbin/afs/src/milko/pts/ptserver.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,18 +31,56 @@ * SUCH DAMAGE. */ -/* $Id: ptserver.h,v 1.1 2000/09/11 14:41:19 art Exp $ */ - -int get_pr_entry_by_id(int id, prentry *pr_entry); -int get_pr_entry_by_name(const char *name, prentry *pr_entry); -int conv_name_to_id(const char *name, int *id); -int conv_id_to_name(int id, char *name); -int next_free_group_id(void); -int next_free_user_id(void); -int create_user(const char *name, int32_t id, int32_t owner, int32_t creator); -int create_group(const char *name, int32_t id, int32_t owner, int32_t creator); -int addtogroup(int32_t uid, int32_t gid); -int removefromgroup(int32_t uid, int32_t gid); -int listelements(int32_t id, prlist *elist, Bool default_id_p); -char *localize_name(const char *name); +/* $KTH: ptserver.h,v 1.8 2000/10/03 00:20:56 lha Exp $ */ + +#define PRDB_DB 0x0200000 +#define PRDB_RPC 0x0400000 +#define PRDB_WARN 0x0800000 +#define PRDB_ERROR 0x1000000 + +#define PR_DEFAULT_LOG (PRDB_WARN|PRDB_ERROR) + +void +pt_setdebug (char *debug_level); + +void +pt_debug (unsigned int level, char *fmt, ...); + +int +get_pr_entry_by_id(int id, prentry *pr_entry); + +int +get_pr_entry_by_name(const char *name, prentry *pr_entry); + +int +conv_name_to_id(const char *name, int *id); + +int +conv_id_to_name(int id, char *name); + +int +next_free_group_id(void); + +int +next_free_user_id(void); + +int +create_user(const char *name, int32_t id, int32_t owner, int32_t creator); +int +create_group(const char *name, int32_t id, int32_t owner, int32_t creator); + +int +addtogroup(int32_t uid, int32_t gid); + +int +removefromgroup(int32_t uid, int32_t gid); + +int +listelements(int32_t id, prlist *elist, Bool default_id_p); + +char * +localize_name(const char *name); + extern prheader pr_header; + + diff --git a/usr.sbin/afs/src/milko/vldb/Makefile.in b/usr.sbin/afs/src/milko/vldb/Makefile.in index b13ef6603a9..9da4c3a44b5 100644 --- a/usr.sbin/afs/src/milko/vldb/Makefile.in +++ b/usr.sbin/afs/src/milko/vldb/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:20 art Exp $ +# $KTH: Makefile.in,v 1.12 2000/10/10 20:56:29 lha Exp $ srcdir = @srcdir@ +top_builddir = ../.. VPATH = @srcdir@ CC = @CC@ @@ -36,6 +37,7 @@ INCLUDES = -I$(srcdir)/../.. \ -I$(srcdir)/../../include \ -I$(srcdir)/../lib/msecurity \ -I../../rxdef \ + @INC_roken@ \ $(RXKADINC) DEFINES = -DDEBUG REALCFLAGS = $(INCLUDES) @KRB4_INC_FLAGS@ $(DEFINES) $(CFLAGS) -DRXDEBUG @@ -47,11 +49,12 @@ LIBS = -L../../rxdef -lrxvlserver \ -L../../lib/ko -lko \ -L../../util -lutil \ -L../../lwp -llwp @PLWP_LIB_FLAGS@ \ - -L../../lib/roken -lroken $(RXKADLIB) \ + $(RXKADLIB) \ + @LIB_roken@ \ @LIBS@ LIBDEPENDS = ../../rxdef/librxdefclient.a ../../rx/librx.a \ ../../lwp/liblwp.a ../../util/libutil.a \ - ../../lib/roken/libroken.a ../../lib/ko/libko.a \ + ../../lib/ko/libko.a \ ../lib/voldb/libvoldb.a ../lib/vld/libvld.a \ ../lib/msecurity/libmsecurity.a PROGS = vldbserver vled diff --git a/usr.sbin/afs/src/milko/vldb/ubikprocs.c b/usr.sbin/afs/src/milko/vldb/ubikprocs.c index 830fae7fb68..c604a4ed64c 100644 --- a/usr.sbin/afs/src/milko/vldb/ubikprocs.c +++ b/usr.sbin/afs/src/milko/vldb/ubikprocs.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -44,7 +39,7 @@ #include <krb.h> #endif -RCSID("$Id: ubikprocs.c,v 1.1 2000/09/11 14:41:20 art Exp $"); +RCSID("$KTH: ubikprocs.c,v 1.3 2000/10/03 00:21:02 lha Exp $"); int Ubik_Beacon(struct rx_call *call, const int32_t state, diff --git a/usr.sbin/afs/src/milko/vldb/vl_db.c b/usr.sbin/afs/src/milko/vldb/vl_db.c index 6dd4b025aae..9156d676e5f 100644 --- a/usr.sbin/afs/src/milko/vldb/vl_db.c +++ b/usr.sbin/afs/src/milko/vldb/vl_db.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "vldb_locl.h" -RCSID("$Id: vl_db.c,v 1.1 2000/09/11 14:41:20 art Exp $"); +RCSID("$KTH: vl_db.c,v 1.3 2000/10/03 00:21:07 lha Exp $"); static void open_db (char *databaseprefix, int flags); diff --git a/usr.sbin/afs/src/milko/vldb/vldb_locl.h b/usr.sbin/afs/src/milko/vldb/vldb_locl.h index c916595a83b..913606914a2 100644 --- a/usr.sbin/afs/src/milko/vldb/vldb_locl.h +++ b/usr.sbin/afs/src/milko/vldb/vldb_locl.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -69,7 +64,7 @@ #include <msecurity.h> #include <netinit.h> -#include <getarg.h> +#include <agetarg.h> #include "rx/rxgencon.h" #include "vldb.h" diff --git a/usr.sbin/afs/src/milko/vldb/vldbserver.c b/usr.sbin/afs/src/milko/vldb/vldbserver.c index 31903a258fd..ea5c20b5df8 100644 --- a/usr.sbin/afs/src/milko/vldb/vldbserver.c +++ b/usr.sbin/afs/src/milko/vldb/vldbserver.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "vldb_locl.h" -RCSID("$Id: vldbserver.c,v 1.1 2000/09/11 14:41:20 art Exp $"); +RCSID("$KTH: vldbserver.c,v 1.33 2001/01/01 20:42:58 lha Exp $"); static void make_vldb_from_vl(struct vldbentry *vldb_entry, struct disk_vlentry *vl_entry); @@ -736,36 +731,39 @@ static char *cell = NULL; static char *realm = NULL; static char *databasedir = NULL; static char *srvtab_file = NULL; +static char *log_file = "syslog"; static int no_auth = 0; static int do_create = 0; static int vlsrv_debug = 0; -static struct getargs args[] = { - {"create", 0, arg_flag, &do_create, "create new database"}, - {"cell", 0, arg_string, &cell, "what cell to use"}, - {"realm", 0, arg_string, &realm, "what realm to use"}, - {"prefix",'p', arg_string, &databasedir, "what dir to store the db"}, - {"noauth", 0, arg_flag, &no_auth, "disable authentication checks"}, - {"debug", 'd', arg_flag, &vlsrv_debug, "output debugging"}, - {"srvtab",'s', arg_string, &srvtab_file, "what srvtab to use"}, - { NULL, 0, arg_end, NULL } +static struct agetargs args[] = { + {"create", 0, aarg_flag, &do_create, "create new database"}, + {"cell", 0, aarg_string, &cell, "what cell to use"}, + {"realm", 0, aarg_string, &realm, "what realm to use"}, + {"prefix",'p', aarg_string, &databasedir, "what dir to store the db"}, + {"noauth", 0, aarg_flag, &no_auth, "disable authentication checks"}, + {"debug", 'd', aarg_flag, &vlsrv_debug, "output debugging"}, + {"log", 'd', aarg_string, &log_file, "log file"}, + {"srvtab",'s', aarg_string, &srvtab_file, "what srvtab to use"}, + { NULL, 0, aarg_end, NULL } }; static void usage(void) { - arg_printusage(args, NULL, "", ARG_AFSSTYLE); + aarg_printusage(args, NULL, "", AARG_AFSSTYLE); } int main(int argc, char **argv) { - int ret; + Log_method *method; int optind = 0; + int ret; set_progname (argv[0]); - if (getarg (args, argc, argv, &optind, ARG_AFSSTYLE)) { + if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) { usage (); return 1; } @@ -789,8 +787,12 @@ main(int argc, char **argv) return 0; } + method = log_open (get_progname(), log_file); + if (method == NULL) + errx (1, "log_open failed"); + cell_init(0, method); ports_init(); - cell_init(0); + if (cell) cell_setthiscell (cell); @@ -805,7 +807,7 @@ main(int argc, char **argv) errx (1, "network_init failed with %d", ret); ret = network_init(htons(afsvldbport), "ubik", VOTE_SERVICE_ID, - Ubik_ExecuteRequest, &ubikservice, NULL); + Ubik_ExecuteRequest, &ubikservice, realm); if (ret) errx (1, "network_init failed with %d", ret); diff --git a/usr.sbin/afs/src/milko/vldb/vled.c b/usr.sbin/afs/src/milko/vldb/vled.c index eb86da17f24..7f125201329 100644 --- a/usr.sbin/afs/src/milko/vldb/vled.c +++ b/usr.sbin/afs/src/milko/vldb/vled.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -42,7 +37,7 @@ #include <arpa/inet.h> #include <limits.h> -RCSID("$Id: vled.c,v 1.1 2000/09/11 14:41:20 art Exp $"); +RCSID("$KTH: vled.c,v 1.6 2000/10/03 00:21:23 lha Exp $"); struct ed_context { long begin; diff --git a/usr.sbin/afs/src/rx/Makefile.in b/usr.sbin/afs/src/rx/Makefile.in index a6474c4eaab..050f6688624 100644 --- a/usr.sbin/afs/src/rx/Makefile.in +++ b/usr.sbin/afs/src/rx/Makefile.in @@ -1,9 +1,10 @@ # -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:20 art Exp $ +# $KTH: Makefile.in,v 1.37.2.1 2001/09/15 13:33:59 mattiasa Exp $ # SHELL = /bin/sh srcdir = @srcdir@ +top_builddir = .. VPATH = @srcdir@ CC = @CC@ @@ -22,11 +23,12 @@ bindir = @bindir@ sbindir = @sbindir@ libdir = @libdir@ includedir = @includedir@ +mandir = @mandir@ DEFS = @DEFS@ -DRXDEBUG CFLAGS = @CFLAGS@ INCLUDES = -I$(srcdir) -I../include -I$(srcdir)/../include \ - @KRB4_INC_FLAGS@ -I$(srcdir)/../lib/cmd + @INC_roken@ @KRB4_INC_FLAGS@ -I$(srcdir)/../lib/cmd LIB = librx.a include_HEADERS = rx.h rx_clock.h rx_event.h rx_globs.h rx_mach.h rx_misc.h \ @@ -100,7 +102,7 @@ install: all e=`echo $$x | sed 's/.*\.\([1-9a-zA-Z]*\)$$/\1/'`; \ f=`echo $$n | sed '$(transform)'`; \ $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$$e ; \ - $(INSTALL_PROGRAM) $(srcdir)/$$x \ + $(INSTALL_DATA) $(srcdir)/$$x \ $(DESTDIR)$(mandir)/man$$e/$$f.$$e; \ done @@ -141,10 +143,10 @@ test_rx_clock: $(test_rx_clock_OBJECTS) $(LIB) $(CC) -o $@ $(test_rx_clock_OBJECTS) -L. -lrx $(LIBS) rxdebug: $(rxdebug_OBJECTS) $(LIB) - $(CC) -o $@ $(rxdebug_OBJECTS) -L../lib/cmd -lcmd -L. -lrx $(LIBS) -L../lwp -llwp @PLWP_LIB_FLAGS@ -L../lib/roken -lroken @LIBS@ + $(CC) -o $@ $(rxdebug_OBJECTS) -L../lib/cmd -lcmd -L. -lrx $(LIBS) -L../lwp -llwp @PLWP_LIB_FLAGS@ -L../lib/ko -lko @LIB_roken@ @LIBS@ rxperf: $(rxperf_OBJECTS) $(LIB) - $(CC) -o $@ $(rxperf_OBJECTS) -L../lib/cmd -lcmd -L. -lrx $(LIBS) -L../lwp -llwp @PLWP_LIB_FLAGS@ -L../lib/roken -lroken @LIBS@ + $(CC) -o $@ $(rxperf_OBJECTS) -L../lib/cmd -lcmd -L. -lrx $(LIBS) -L../lwp -llwp @PLWP_LIB_FLAGS@ @LIB_roken@ @LIBS@ TAGS: $(SOURCES) etags $(SOURCES) diff --git a/usr.sbin/afs/src/rx/rx.c b/usr.sbin/afs/src/rx/rx.c index 54c23f8cb94..4ac98faecc5 100644 --- a/usr.sbin/afs/src/rx/rx.c +++ b/usr.sbin/afs/src/rx/rx.c @@ -21,9 +21,10 @@ /* RX: Extended Remote Procedure Call */ +#include <assert.h> #include "rx_locl.h" -RCSID("$Id: rx.c,v 1.3 2000/09/11 14:41:20 art Exp $"); +RCSID("$KTH: rx.c,v 1.20 2001/01/07 16:42:43 lha Exp $"); /* * quota system: each attached server process must be able to make @@ -305,6 +306,7 @@ rx_NewConnection(u_long shost, u_short sport, u_short sservice, conn->cid = cid; conn->epoch = rx_epoch; conn->peer = rxi_FindPeer(shost, sport); + queue_Append(&conn->peer->connQueue, conn); conn->serviceId = sservice; conn->securityObject = securityObject; conn->securityData = (void *) 0; @@ -422,6 +424,7 @@ rx_DestroyConnection(struct rx_connection * conn) /* Make sure that the connection is completely reset before deleting it. */ rxi_ResetConnection(conn); + queue_Remove(conn); if (--conn->peer->refCount == 0) conn->peer->idleWhen = clock_Sec(); @@ -1162,8 +1165,12 @@ rxi_FreeCall(struct rx_call * call) * connections). Only do this, however, if there are no * outstanding calls */ - if (conn->flags & RX_CONN_DESTROY_ME) + if (conn->flags & RX_CONN_DESTROY_ME) { +#if 0 + conn->refCount++; +#endif rx_DestroyConnection(conn); + } } @@ -1225,6 +1232,7 @@ rxi_FindPeer(u_long host, u_short port) */ pp->port = port; queue_Init(&pp->congestionQueue); + queue_Init(&pp->connQueue); pp->next = rx_peerHashTable[hashIndex]; rx_peerHashTable[hashIndex] = pp; rxi_InitPeerParams(pp); @@ -1261,6 +1269,7 @@ static void rxi_DestroyPeer(struct rx_peer * peer) { rxi_RemovePeer(peer); + assert(queue_IsEmpty(&peer->connQueue)); rxi_FreePeer(peer); rx_stats.nPeerStructs--; } @@ -1281,9 +1290,19 @@ rxi_InsertPeer(struct rx_peer *peer) break; } if (pp != NULL) { + struct rx_connection *conn, *next; + pp->refCount += peer->refCount; pp->nSent += peer->nSent; pp->reSends += peer->reSends; + + for (queue_Scan(&peer->connQueue, conn, next, rx_connection)) { + conn->peer = pp; + queue_Remove(conn); + queue_Append(&pp->connQueue, conn); + } + + assert(queue_IsEmpty(&peer->connQueue)); rxi_FreePeer(peer); rx_stats.nPeerStructs--; return pp; @@ -1360,6 +1379,7 @@ rxi_FindConnection(osi_socket socket, long host, conn->next = rx_connHashTable[hashindex]; rx_connHashTable[hashindex] = conn; conn->peer = rxi_FindPeer(host, port); + queue_Append(&conn->peer->connQueue, conn); conn->maxPacketSize = MIN(conn->peer->packetSize, OLD_MAX_PACKET_SIZE); conn->type = RX_SERVER_CONNECTION; conn->lastSendTime = clock_Sec(); /* don't GC immediately */ @@ -2617,7 +2637,7 @@ struct rx_packet * rxi_SendCallAbort(struct rx_call * call, struct rx_packet * packet) { if (call->error) { - long error; + int32_t error; error = htonl(call->error); packet = rxi_SendSpecial(call, call->conn, packet, RX_PACKET_TYPE_ABORT, @@ -2635,7 +2655,7 @@ rxi_SendConnectionAbort(struct rx_connection * conn, struct rx_packet * packet) { if (conn->error) { - long error; + int32_t error; error = htonl(conn->error); packet = rxi_SendSpecial((struct rx_call *) 0, conn, packet, @@ -3223,9 +3243,10 @@ rxi_Send(struct rx_call *call, struct rx_packet *p) * Check if a call needs to be destroyed. Called by keep-alive code to ensure * that things are fine. Also called periodically to guarantee that nothing * falls through the cracks (e.g. (error + dally) connections have keepalive - * turned off. Returns 0 if conn is well, -1 otherwise. If otherwise, call - * may be freed! + * turned off. Returns 0 if conn is well, negativ otherwise. + * -1 means that the call still exists, -2 means that the call is freed. */ + static int rxi_CheckCall(struct rx_call *call) { @@ -3241,17 +3262,21 @@ rxi_CheckCall(struct rx_call *call) * seconds. */ if (now > (call->lastReceiveTime + conn->secondsUntilDead)) { - if (call->state == RX_STATE_ACTIVE) + + if (call->state == RX_STATE_ACTIVE) { rxi_CallError(call, RX_CALL_DEAD); - else + return -1; + } else { rxi_FreeCall(call); + return -2; + } /* * Non-active calls are destroyed if they are not responding to * pings; active calls are simply flagged in error, so the attached * process can die reasonably gracefully. */ - return -1; + } /* see if we have a non-activity timeout */ tservice = conn->service; @@ -3397,11 +3422,12 @@ rxi_DecongestionEvent(struct rxevent *event, struct rx_peer *peer, struct rx_call *call; struct rx_call *nxcall; /* Next pointer for queue_Scan */ - peer->refCount--; /* It was bumped by the callee */ peer->burst += nPackets; if (peer->burst > peer->burstSize) peer->burst = peer->burstSize; for (queue_Scan(&peer->congestionQueue, call, nxcall, rx_call)) { + assert(queue_IsNotEmpty(&peer->congestionQueue)); + assert(queue_Prev(&peer->congestionQueue, rx_call)); queue_Remove(call); /* @@ -3412,8 +3438,11 @@ rxi_DecongestionEvent(struct rxevent *event, struct rx_peer *peer, */ rxi_Start((struct rxevent *) 0, call); if (!peer->burst) - return; + goto done; } + done: + peer->refCount--; /* It was bumped by the callee */ + return; } /* @@ -3448,6 +3477,8 @@ rxi_CongestionWait(struct rx_call *call) { if (queue_IsOnQueue(call)) return; + assert(queue_IsNotEmpty(&call->conn->peer->congestionQueue)); + assert(queue_Prev(&call->conn->peer->congestionQueue, rx_call)); queue_Append(&call->conn->peer->congestionQueue, call); } @@ -3569,13 +3600,15 @@ rxi_ReapConnections(void) */ { struct rx_connection **conn_ptr, **conn_end; - int i, havecalls = 0; + int i, havecalls = 0, ret; - for (conn_ptr = &rx_connHashTable[0], - conn_end = &rx_connHashTable[rx_hashTableSize]; - conn_ptr < conn_end; conn_ptr++) { + for (conn_ptr = &rx_connHashTable[0], + conn_end = &rx_connHashTable[rx_hashTableSize]; + conn_ptr < conn_end; + conn_ptr++) { struct rx_connection *conn, *next; + rereap: for (conn = *conn_ptr; conn; conn = next) { next = conn->next; /* once a minute look at everything to see what's up */ @@ -3583,7 +3616,14 @@ rxi_ReapConnections(void) for (i = 0; i < RX_MAXCALLS; i++) { if (conn->call[i]) { havecalls = 1; - rxi_CheckCall(conn->call[i]); + ret = rxi_CheckCall(conn->call[i]); + if (ret == -2) { + /* If CheckCall freed the call, it might + * have destroyed the connection as well, + * which screws up the linked lists. + */ + goto rereap; + } } } if (conn->type == RX_SERVER_CONNECTION) { diff --git a/usr.sbin/afs/src/rx/rx.h b/usr.sbin/afs/src/rx/rx.h index 2c0f7ec0253..f92e0c0778f 100644 --- a/usr.sbin/afs/src/rx/rx.h +++ b/usr.sbin/afs/src/rx/rx.h @@ -1,4 +1,4 @@ -/* $Id: rx.h,v 1.4 2002/02/19 19:39:39 millert Exp $ */ +/* $KTH: rx.h,v 1.19 2001/01/06 21:54:20 lha Exp $ */ /* **************************************************************************** @@ -296,8 +296,13 @@ struct rx_securityClass { int refCount; }; +#if defined(__STDC__) && !defined(__HIGHC__) #define RXS_OP(obj,op,args) ((obj->ops->op_ ## op) ? \ (*(obj)->ops->op_ ## op)args : 0) +#else +#define RXS_OP(obj,op,args) ((obj->ops->op_/**/op) ? \ + (*(obj)->ops->op_/**/op)args : 0) +#endif #define RXS_Close(obj) RXS_OP(obj,Close,(obj)) #define RXS_NewConnection(obj,conn) RXS_OP(obj,NewConnection,(obj,conn)) @@ -417,6 +422,7 @@ struct rx_serverQueueEntry { */ struct rx_peer { struct rx_peer *next; /* Next in hash conflict or free list */ + struct rx_queue connQueue; /* a list of all conn use this peer */ u_long host; /* Remote IP address, in net byte * order */ u_short port; /* Remote UDP port, in net byte order */ @@ -484,6 +490,7 @@ struct rx_peer { * limited multiple asynchronous conversations. */ struct rx_connection { + struct rx_queue queue_item; /* conns on same peer */ struct rx_connection *next; /* on hash chain _or_ free list */ struct rx_peer *peer; #ifdef RX_ENABLE_LOCKS @@ -862,6 +869,9 @@ struct rx_ackPacket { * codes */ +/* Min rx error */ +#define RX_MIN_ERROR (-1) + /* Something bad happened to the connection; temporary loss of communication */ #define RX_CALL_DEAD (-1) @@ -893,6 +903,9 @@ struct rx_ackPacket { /* EMSGSIZE returned from network. Packet too big, must fragment */ #define RX_MSGSIZE (-8) +/* Max rx error */ +#define RX_MAX_ERROR (-64) + /* * Structure for keeping rx statistics. Note that this structure is returned * by rxdebug, so, for compatibility reasons, new fields should be appended (or diff --git a/usr.sbin/afs/src/rx/rx_clock.c b/usr.sbin/afs/src/rx/rx_clock.c index 1418b59f5be..da9bb5f3b26 100644 --- a/usr.sbin/afs/src/rx/rx_clock.c +++ b/usr.sbin/afs/src/rx/rx_clock.c @@ -20,233 +20,77 @@ */ /* Elapsed time package */ -/* See rx_clock.h for calling conventions */ #include "rx_locl.h" -RCSID("$Id: rx_clock.c,v 1.3 2000/09/11 14:41:21 art Exp $"); +RCSID("$KTH: rx_clock.c,v 1.15 2000/11/26 22:29:28 lha Exp $"); #ifndef KERNEL -#ifdef HAVE_GETITIMER +struct clock clock_now; -struct clock clock_now; /* The last elapsed time ready by - * clock_GetTimer */ - -/* - * This is set to 1 whenever the time is read, and reset to 0 whenever - * clock_NewTime is called. This is to allow the caller to control the - * frequency with which the actual time is re-evaluated (an expensive - * operation) - */ int clock_haveCurrentTime; -int clock_nUpdates; /* The actual number of clock updates */ - -/* - * Dynamically figured out start-value of the ITIMER_REAL interval timer - */ - -static struct clock startvalue; - -/* - * The offset we need to add. - */ - -static struct clock offset; - -/* - * We need to restart the timer. - */ - -static int do_restart; - -/* - * When the interval timer has counted to zero, set offset and make - * sure it gets restarted. - */ - -static void -alrm_handler (int signo) -{ - clock_Add(&offset, &startvalue); - do_restart = 1; - clock_NewTime (); -} - -/* - * Install handler for SIGALRM - */ - -static void -set_alrm_handler (void) -{ -#if defined(HAVE_POSIX_SIGNALS) && defined(SA_RESTART) - { - struct sigaction act; - - sigemptyset(&act.sa_mask); - act.sa_flags = SA_RESTART; - act.sa_handler = alrm_handler; - if (sigaction (SIGALRM, &act, NULL) < 0) { - fprintf (stderr, "sigaction failed"); - exit (1); - } - } -#else - signal (SIGALRM, alrm_handler); -#endif -} - -/* - * Start an interval timer counting down to `timer_val' - */ - -static int -clock_starttimer (time_t timer_val) -{ - struct itimerval itimer; - - itimer.it_value.tv_sec = timer_val; - itimer.it_value.tv_usec = 0; - itimer.it_interval.tv_sec = 0; - itimer.it_interval.tv_usec = 0; +int clock_nUpdates; - if (setitimer (ITIMER_REAL, &itimer, NULL) != 0) { - if (errno != EINVAL) { - fprintf (stderr, "setitimer failed\n"); - exit (1); - } - return 1; - } - if (getitimer (ITIMER_REAL, &itimer) != 0) { - fprintf (stderr, "setitimer failed\n"); - exit (1); - } - startvalue.sec = itimer.it_value.tv_sec; - startvalue.usec = itimer.it_value.tv_usec; - do_restart = 0; - set_alrm_handler (); - return 0; -} +/* Magic tdiff that guarantees a monotonically increasing clock value. */ +static struct clock tdiff; -/* Initialize the clock */ void clock_Init(void) { - static int initialized = 0; - int timer_val; - - for (timer_val = INT_MAX; - !initialized && clock_starttimer (timer_val); - timer_val /= 2) - ; - initialized = 1; - clock_UpdateTime(); -} - -/* - * Compute the current time. The timer gets the current total elapsed - * time since startup, expressed in seconds and microseconds. This call - * is almost 200 usec on an APC RT - */ -void -clock_UpdateTime(void) -{ - struct itimerval itimer; - struct clock tmp_clock; - - if (do_restart) - clock_starttimer (startvalue.sec); - - getitimer(ITIMER_REAL, &itimer); - tmp_clock.sec = itimer.it_value.tv_sec; - tmp_clock.usec = itimer.it_value.tv_usec; - - clock_now = offset; - clock_Add(&clock_now, &startvalue); - clock_Sub(&clock_now, &tmp_clock); - - clock_haveCurrentTime = 1; - clock_nUpdates++; -} - -/* Restart the interval timer */ -void -clock_ReInit(void) -{ - struct clock tmp_clock; - struct itimerval itimer; - - tmp_clock = offset; - clock_Add(&tmp_clock, &startvalue); - clock_Sub(&tmp_clock, &clock_now); - itimer.it_value.tv_sec = tmp_clock.sec; - itimer.it_value.tv_usec = tmp_clock.usec; - itimer.it_interval.tv_sec = 0; - itimer.it_interval.tv_usec = 0; - - if (setitimer(ITIMER_REAL, &itimer, NULL) != 0) { - fprintf(stderr, "clock: could not set interval timer; aborted\n"); - fflush(stderr); - exit(1); - } -} - -#else /* ! HAVE_GETITIMER */ - -struct clock clock_now; /* The last elapsed time ready by - * clock_GetTimer */ - -static struct clock offset; /* time when we start counting */ - -/* - * This is set to 1 whenever the time is read, and reset to 0 whenever - * clock_NewTime is called. This is to allow the caller to control the - * frequency with which the actual time is re-evaluated (an expensive - * operation) - */ -int clock_haveCurrentTime; - -int clock_nUpdates; /* The actual number of clock updates */ - -/* Initialize the clock */ + struct timeval tv; -void -clock_Init(void) -{ - clock_UpdateTime(); - offset = clock_now; + gettimeofday(&tv, 0); + tdiff.sec = tv.tv_sec; + tdiff.usec = tv.tv_usec; clock_now.sec = clock_now.usec = 0; + clock_haveCurrentTime = 1; + clock_nUpdates = 0; } -/* - * Compute the current time. - */ - +/* Refresh value of clock_now. */ void clock_UpdateTime(void) { struct timeval tv; - - gettimeofday (&tv, NULL); - - clock_now.sec = tv.tv_sec; - clock_now.usec = tv.tv_usec; - - clock_Sub(&clock_now, &offset); - + struct clock t; + + gettimeofday(&tv, 0); + t.sec = tv.tv_sec; + t.usec = tv.tv_usec; + clock_Sub(&t, &tdiff); + + /* We can't have time running backwards!!! */ + if (clock_Le(&t, &clock_now)) + { + /* Calculate new tdiff. */ + t.sec = tv.tv_sec; + t.usec = tv.tv_usec; + clock_Sub(&t, &clock_now); + tdiff.sec = t.sec; + tdiff.usec = t.usec; + + /* Fake new time. */ + t.sec = tv.tv_sec; + t.usec = tv.tv_usec; + clock_Sub(&t, &tdiff); + t.usec++; + if (t.usec >= 1000000) + { + t.sec += 1; + t.usec = 0; + } + } + + clock_now = t; clock_haveCurrentTime = 1; clock_nUpdates++; } -/* Restart the interval timer */ void clock_ReInit(void) { } -#endif /* HAVE_GETITIMER */ - -#else /* KERNEL */ #endif /* KERNEL */ diff --git a/usr.sbin/afs/src/rx/rx_clock.h b/usr.sbin/afs/src/rx/rx_clock.h index fd0cad4a711..3adbeb85141 100644 --- a/usr.sbin/afs/src/rx/rx_clock.h +++ b/usr.sbin/afs/src/rx/rx_clock.h @@ -1,4 +1,4 @@ -/* $Id: rx_clock.h,v 1.2 2000/09/11 14:41:21 art Exp $ */ +/* $KTH: rx_clock.h,v 1.4 1999/05/04 09:13:44 assar Exp $ */ /* **************************************************************************** diff --git a/usr.sbin/afs/src/rx/rx_event.c b/usr.sbin/afs/src/rx/rx_event.c index bbccd0deb42..a1a07e04cb8 100644 --- a/usr.sbin/afs/src/rx/rx_event.c +++ b/usr.sbin/afs/src/rx/rx_event.c @@ -21,7 +21,7 @@ #include "rx_locl.h" -RCSID("$Id: rx_event.c,v 1.2 2000/09/11 14:41:21 art Exp $"); +RCSID("$KTH: rx_event.c,v 1.5 2000/09/04 03:59:54 lha Exp $"); /* * All event processing is relative to the apparent current time @@ -212,6 +212,7 @@ rxevent_RaiseEvents(struct clock * next) return 0; } +#if 0 static void shutdown_rxevent(void) { @@ -227,3 +228,4 @@ shutdown_rxevent(void) } #endif } +#endif diff --git a/usr.sbin/afs/src/rx/rx_globs.c b/usr.sbin/afs/src/rx/rx_globs.c index b7dd4bd67e1..d393656d742 100644 --- a/usr.sbin/afs/src/rx/rx_globs.c +++ b/usr.sbin/afs/src/rx/rx_globs.c @@ -27,4 +27,4 @@ #include "rx_locl.h" -RCSID("$Id: rx_globs.c,v 1.2 2000/09/11 14:41:21 art Exp $"); +RCSID("$KTH: rx_globs.c,v 1.5 1998/02/26 14:38:27 art Exp $"); diff --git a/usr.sbin/afs/src/rx/rx_globs.h b/usr.sbin/afs/src/rx/rx_globs.h index 2d203f25853..7462e125100 100644 --- a/usr.sbin/afs/src/rx/rx_globs.h +++ b/usr.sbin/afs/src/rx/rx_globs.h @@ -1,4 +1,4 @@ -/* $Id: rx_globs.h,v 1.2 2000/09/11 14:41:21 art Exp $ */ +/* $KTH: rx_globs.h,v 1.6 2000/10/08 17:48:15 assar Exp $ */ /* **************************************************************************** @@ -140,11 +140,6 @@ EXT osi_socket rx_socket; /* Port requested at rx_Init. If this is zero, the actual port used will be different--but it will only be used for client operations. If non-zero, server provided services may use the same port. */ EXT u_short rx_port; -/* 32-bit select Mask for rx_Listener. We use 32 bits because IOMGR_Select only supports 32 */ -EXT fd_set rx_selectMask; -EXT int rx_maxSocketNumber; /* Maximum socket number represented - * in the select mask */ - /* This is actually the minimum number of packets that must remain free, overall, immediately after a packet of the requested class has been allocated. *WARNING* These must be assigned with a great deal of care. diff --git a/usr.sbin/afs/src/rx/rx_kern.h b/usr.sbin/afs/src/rx/rx_kern.h index 5c1179559b2..b6830817161 100644 --- a/usr.sbin/afs/src/rx/rx_kern.h +++ b/usr.sbin/afs/src/rx/rx_kern.h @@ -1,4 +1,4 @@ -/* $Id: rx_kern.h,v 1.2 2000/09/11 14:41:22 art Exp $ */ +/* $KTH: rx_kern.h,v 1.3 1998/02/22 19:46:53 joda Exp $ */ /* **************************************************************************** diff --git a/usr.sbin/afs/src/rx/rx_locl.h b/usr.sbin/afs/src/rx/rx_locl.h index 69180b09f6d..f75062fd2f9 100644 --- a/usr.sbin/afs/src/rx/rx_locl.h +++ b/usr.sbin/afs/src/rx/rx_locl.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: rx_locl.h,v 1.2 2000/09/11 14:41:22 art Exp $ */ +/* $KTH: rx_locl.h,v 1.6 2000/10/03 00:41:28 lha Exp $ */ #ifndef __RX_LOCL_H__ #define __RX_LOCL_H__ diff --git a/usr.sbin/afs/src/rx/rx_mach.h b/usr.sbin/afs/src/rx/rx_mach.h index 5804fa926cc..eff36b7746e 100644 --- a/usr.sbin/afs/src/rx/rx_mach.h +++ b/usr.sbin/afs/src/rx/rx_mach.h @@ -1,7 +1,7 @@ #ifndef _RX_MACHDEP_ #define _RX_MACHDEP_ -/* $Header: /cvs/OpenBSD/src/usr.sbin/afs/src/rx/Attic/rx_mach.h,v 1.2 2000/09/11 14:41:22 art Exp $ */ +/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_mach.h,v 1.3 1998/03/29 01:25:32 assar Exp $ */ /* **************************************************************************** * Copyright IBM Corporation 1988, 1989 - All Rights Reserved * diff --git a/usr.sbin/afs/src/rx/rx_misc.c b/usr.sbin/afs/src/rx/rx_misc.c index 0c62562744c..a36e253f1d3 100644 --- a/usr.sbin/afs/src/rx/rx_misc.c +++ b/usr.sbin/afs/src/rx/rx_misc.c @@ -1,6 +1,6 @@ #include "rx_locl.h" -RCSID("$Id: rx_misc.c,v 1.2 2000/09/11 14:41:22 art Exp $"); +RCSID("$KTH: rx_misc.c,v 1.4 1998/02/22 19:47:15 joda Exp $"); /* * We currently only include below the errors that diff --git a/usr.sbin/afs/src/rx/rx_misc.h b/usr.sbin/afs/src/rx/rx_misc.h index 558f652cff1..a3312dff56f 100644 --- a/usr.sbin/afs/src/rx/rx_misc.h +++ b/usr.sbin/afs/src/rx/rx_misc.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: rx_misc.h,v 1.2 2000/09/11 14:41:22 art Exp $ */ +/* $KTH: rx_misc.h,v 1.2 2000/10/03 00:41:33 lha Exp $ */ #ifndef __RX_MISC_H #define __RX_MISC_H diff --git a/usr.sbin/afs/src/rx/rx_multi.c b/usr.sbin/afs/src/rx/rx_multi.c index d837e382bc2..15596d45516 100644 --- a/usr.sbin/afs/src/rx/rx_multi.c +++ b/usr.sbin/afs/src/rx/rx_multi.c @@ -21,7 +21,7 @@ #include "rx_locl.h" -RCSID("$Id: rx_multi.c,v 1.2 2000/09/11 14:41:22 art Exp $"); +RCSID("$KTH: rx_multi.c,v 1.6 2000/03/03 08:56:12 assar Exp $"); /* multi.c and multi.h, together with some rxgen hooks, provide a way of making multiple, but similar, rx calls to multiple hosts simultaneously */ diff --git a/usr.sbin/afs/src/rx/rx_multi.h b/usr.sbin/afs/src/rx/rx_multi.h index 9b39198fe3c..77026994272 100644 --- a/usr.sbin/afs/src/rx/rx_multi.h +++ b/usr.sbin/afs/src/rx/rx_multi.h @@ -1,4 +1,4 @@ -/* $Id: rx_multi.h,v 1.2 2000/09/11 14:41:22 art Exp $ */ +/* $KTH: rx_multi.h,v 1.3 1998/02/22 19:48:23 joda Exp $ */ /* **************************************************************************** diff --git a/usr.sbin/afs/src/rx/rx_null.c b/usr.sbin/afs/src/rx/rx_null.c index 07d90f3c927..4203ddddc85 100644 --- a/usr.sbin/afs/src/rx/rx_null.c +++ b/usr.sbin/afs/src/rx/rx_null.c @@ -22,7 +22,7 @@ #include "rx_locl.h" #include "rx_null.h" -RCSID("$Id: rx_null.c,v 1.2 2000/09/11 14:41:22 art Exp $"); +RCSID("$KTH: rx_null.c,v 1.4 1999/12/31 05:42:06 assar Exp $"); /* The null security object. No authentication, no nothing. */ diff --git a/usr.sbin/afs/src/rx/rx_null.h b/usr.sbin/afs/src/rx/rx_null.h index 5a744378b3b..4b6bc9cbe76 100644 --- a/usr.sbin/afs/src/rx/rx_null.h +++ b/usr.sbin/afs/src/rx/rx_null.h @@ -1,5 +1,5 @@ -/* $Header: /cvs/OpenBSD/src/usr.sbin/afs/src/rx/Attic/rx_null.h,v 1.2 2000/09/11 14:41:22 art Exp $ */ -/* $Source: /cvs/OpenBSD/src/usr.sbin/afs/src/rx/Attic/rx_null.h,v $ */ +/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_null.h,v 1.3 1998/01/28 04:54:19 art Exp $ */ +/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_null.h,v $ */ /* **************************************************************************** diff --git a/usr.sbin/afs/src/rx/rx_pkt.c b/usr.sbin/afs/src/rx/rx_pkt.c index f8aca75cf88..1750e0d7c96 100644 --- a/usr.sbin/afs/src/rx/rx_pkt.c +++ b/usr.sbin/afs/src/rx/rx_pkt.c @@ -1,6 +1,6 @@ #include "rx_locl.h" -RCSID("$Id: rx_pkt.c,v 1.3 2000/09/11 14:41:22 art Exp $"); +RCSID("$KTH: rx_pkt.c,v 1.15.2.1 2001/07/05 23:16:53 lha Exp $"); struct rx_packet *rx_mallocedP = 0; struct rx_cbuf *rx_mallocedC = 0; @@ -690,6 +690,8 @@ osi_NetSend(osi_socket socket, char *addr, struct iovec *dvec, } FD_ZERO(&sfds); + if (socket >= FD_SETSIZE) + osi_Panic("osi_NetSend: fd too large"); FD_SET(socket, &sfds); while ((err = select(socket + 1, 0, &sfds, 0, 0)) != 1) { if (err >= 0 || errno != EINTR) @@ -1034,17 +1036,39 @@ rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket, long ahost, short aport) { struct sockaddr_in taddr; + int i = 0; + int savelen = 0; + int saven = 0; + int nbytes; taddr.sin_family = AF_INET; taddr.sin_port = aport; taddr.sin_addr.s_addr = ahost; + nbytes = apacket->length; + + for (i = 1; i < apacket->niovecs; i++) { + if (nbytes <= apacket->wirevec[i].iov_len) { + savelen = apacket->wirevec[i].iov_len; + saven = apacket->niovecs; + apacket->wirevec[i].iov_len = nbytes; + apacket->niovecs = i + 1; + /* so condition fails because i == niovecs */ + } else + nbytes -= apacket->wirevec[i].iov_len; + } + GLOBAL_UNLOCK(); /* debug packets are not reliably delivered, hence the cast below. */ /* MTUXXX need to adjust lengths as in sendSpecial */ (void) osi_NetSend(asocket, (char *)&taddr, apacket->wirevec, apacket->niovecs, apacket->length + RX_HEADER_SIZE); GLOBAL_LOCK(); + + if (saven) { + apacket->wirevec[i - 1].iov_len = savelen; + apacket->niovecs = saven; + } } /* @@ -1272,7 +1296,7 @@ get32 (unsigned char **p) void rxi_EncodePacketHeader(struct rx_packet *p) { - unsigned char *buf = p->wirevec[0].iov_base; + unsigned char *buf = (unsigned char *)p->wirevec[0].iov_base; memset(buf, 0, RX_HEADER_SIZE); put32(&buf, p->header.epoch); @@ -1293,7 +1317,7 @@ rxi_EncodePacketHeader(struct rx_packet *p) void rxi_DecodePacketHeader(struct rx_packet *p) { - unsigned char *buf = p->wirevec[0].iov_base; + unsigned char *buf = (unsigned char *)p->wirevec[0].iov_base; u_int32_t temp; p->header.epoch = get32(&buf); diff --git a/usr.sbin/afs/src/rx/rx_queue.h b/usr.sbin/afs/src/rx/rx_queue.h index 88680b8c103..db109e0c883 100644 --- a/usr.sbin/afs/src/rx/rx_queue.h +++ b/usr.sbin/afs/src/rx/rx_queue.h @@ -1,5 +1,5 @@ -/* $Header: /cvs/OpenBSD/src/usr.sbin/afs/src/rx/Attic/rx_queue.h,v 1.2 2000/09/11 14:41:22 art Exp $ */ -/* $Source: /cvs/OpenBSD/src/usr.sbin/afs/src/rx/Attic/rx_queue.h,v $ */ +/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_queue.h,v 1.4 2000/10/02 21:08:29 haba Exp $ */ +/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_queue.h,v $ */ /* **************************************************************************** @@ -116,8 +116,8 @@ for (n=0, queue_Scan(&myqueue, qe, nqe, myelement), n++) {} #define queue_Replace(q1,q2) if (queue_IsEmpty(q2)) queue_Init(q1); else \ (*_RX_QUEUE(q1) = *_RX_QUEUE(q2), _RX_QUEUE(q1)->next->prev = _RX_QUEUE(q1)->prev->next = _RX_QUEUE(q1), queue_Init(q2)) -/* Remove a queue element (*i) from it's queue. The next field is 0'd, so that any further use of this q entry will hopefully cause a core dump. Multiple removes of the same queue item are not supported */ -#define queue_Remove(i) (_QR(i), _RX_QUEUE(i)->next = 0) +/* Remove a queue element (*i) from it's queue. The next and prev field is 0'd, so that any further use of this q entry will hopefully cause a core dump. Multiple removes of the same queue item are not supported */ +#define queue_Remove(i) (_QR(i), _RX_QUEUE(i)->next = 0, _RX_QUEUE(i)->prev = 0 ) /* Move the queue element (*i) from it's queue to the end of the queue (*q) */ #define queue_MoveAppend(q,i) (_QR(i), queue_Append(q,i)) diff --git a/usr.sbin/afs/src/rx/rx_rdwr.c b/usr.sbin/afs/src/rx/rx_rdwr.c index 3c5d7017adb..d570c74d432 100644 --- a/usr.sbin/afs/src/rx/rx_rdwr.c +++ b/usr.sbin/afs/src/rx/rx_rdwr.c @@ -1,6 +1,6 @@ #include "rx_locl.h" -RCSID("$Id: rx_rdwr.c,v 1.2 2000/09/11 14:41:23 art Exp $"); +RCSID("$KTH: rx_rdwr.c,v 1.5 1999/11/18 01:51:18 assar Exp $"); #ifdef AFS_SGIMP_ENV int diff --git a/usr.sbin/afs/src/rx/rx_strm.h b/usr.sbin/afs/src/rx/rx_strm.h index d9e0dc62550..849cfb16847 100644 --- a/usr.sbin/afs/src/rx/rx_strm.h +++ b/usr.sbin/afs/src/rx/rx_strm.h @@ -1,5 +1,5 @@ -/* $Header: /cvs/OpenBSD/src/usr.sbin/afs/src/rx/Attic/rx_strm.h,v 1.2 2000/09/11 14:41:23 art Exp $ */ -/* $Source: /cvs/OpenBSD/src/usr.sbin/afs/src/rx/Attic/rx_strm.h,v $ */ +/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_strm.h,v 1.3 1998/02/22 19:54:23 joda Exp $ */ +/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_strm.h,v $ */ /* **************************************************************************** diff --git a/usr.sbin/afs/src/rx/rx_trace.c b/usr.sbin/afs/src/rx/rx_trace.c index 3800720b47b..a7bbe346c67 100644 --- a/usr.sbin/afs/src/rx/rx_trace.c +++ b/usr.sbin/afs/src/rx/rx_trace.c @@ -1,6 +1,6 @@ #include "rx_locl.h" -RCSID("$Id: rx_trace.c,v 1.3 2000/09/11 14:41:23 art Exp $"); +RCSID("$KTH: rx_trace.c,v 1.5 1998/09/09 10:17:53 assar Exp $"); #ifdef RXTRACEON char rxi_tracename[80] = "/tmp/rxcalltrace"; diff --git a/usr.sbin/afs/src/rx/rx_trace.h b/usr.sbin/afs/src/rx/rx_trace.h index 364f64130af..05b19dcd310 100644 --- a/usr.sbin/afs/src/rx/rx_trace.h +++ b/usr.sbin/afs/src/rx/rx_trace.h @@ -1,4 +1,4 @@ -/* $Header: /cvs/OpenBSD/src/usr.sbin/afs/src/rx/Attic/rx_trace.h,v 1.2 2000/09/11 14:41:23 art Exp $ */ +/* $KTH: /afs/stacken.kth.se/src/SourceRepository/arla/rx/rx_trace.h,v 1.3 1998/02/22 19:55:28 joda Exp $ */ #ifndef _RX_TRACE #define _RX_TRACE diff --git a/usr.sbin/afs/src/rx/rx_user.c b/usr.sbin/afs/src/rx/rx_user.c index 19f071bf0a4..c2a96285382 100644 --- a/usr.sbin/afs/src/rx/rx_user.c +++ b/usr.sbin/afs/src/rx/rx_user.c @@ -26,7 +26,7 @@ #include "rx_locl.h" -RCSID("$Id: rx_user.c,v 1.3 2000/09/11 14:41:23 art Exp $"); +RCSID("$KTH: rx_user.c,v 1.16 2000/10/08 17:49:48 assar Exp $"); #ifndef IPPORT_USERRESERVED /* @@ -38,16 +38,17 @@ RCSID("$Id: rx_user.c,v 1.3 2000/09/11 14:41:23 art Exp $"); #endif /* Don't set this to anything else right now; it is currently broken */ -int (*rx_select) (int, fd_set *, fd_set *, +static int (*rx_select) (int, fd_set *, fd_set *, fd_set *, struct timeval *) = IOMGR_Select; /* * Can be set to "select", in some * cases */ -fd_set rx_selectMask = { {0,0,0,0,0,0,0,0} }; /* XXX */ - -PROCESS rx_listenerPid; /* LWP process id of socket listener +static fd_set rx_selectMask; +static int rx_maxSocketNumber = -1; /* Maximum socket number represented + * in the select mask */ +static PROCESS rx_listenerPid; /* LWP process id of socket listener * process */ void rxi_Listener(void); @@ -152,6 +153,11 @@ rxi_GetUDPSocket(u_short port) return OSI_NULLSOCKET; } + if (socketFd >= FD_SETSIZE) { + (osi_Msg "socket fd too large\n"); + return OSI_NULLSOCKET; + } + #ifdef SO_BSDCOMPAT { int one = 1; @@ -159,6 +165,10 @@ rxi_GetUDPSocket(u_short port) } #endif + if (rx_maxSocketNumber < 0) { + FD_ZERO(&rx_selectMask); + } + FD_SET(socketFd, &rx_selectMask); if (socketFd > rx_maxSocketNumber) rx_maxSocketNumber = socketFd; @@ -361,7 +371,7 @@ osi_Free(char *x, long size) #endif #endif /* AFS_AIX32_ENV */ -#define ADDRSPERSITE 16 +#define ADDRSPERSITE 256 #ifdef ADAPT_MTU diff --git a/usr.sbin/afs/src/rx/rx_user.h b/usr.sbin/afs/src/rx/rx_user.h index 7a6e39bb360..8be13fe4733 100644 --- a/usr.sbin/afs/src/rx/rx_user.h +++ b/usr.sbin/afs/src/rx/rx_user.h @@ -1,4 +1,4 @@ -/* $Id: rx_user.h,v 1.2 2000/09/11 14:41:23 art Exp $ */ +/* $KTH: rx_user.h,v 1.5 1998/03/28 16:35:47 lha Exp $ */ /* **************************************************************************** diff --git a/usr.sbin/afs/src/rx/rxdebug.1 b/usr.sbin/afs/src/rx/rxdebug.1 index 18d568657e6..b75fb285eb5 100644 --- a/usr.sbin/afs/src/rx/rxdebug.1 +++ b/usr.sbin/afs/src/rx/rxdebug.1 @@ -1,5 +1,5 @@ .\" Copyright (c) 2000 Kungliga Tekniska Högskolan -.\" $Id: rxdebug.1,v 1.3 2001/07/25 10:04:57 mpech Exp $ +.\" $KTH: rxdebug.1,v 1.1 2000/08/25 15:04:44 lha Exp $ .Dd Aug 24, 2000 .Dt SECTION .Nm rxdebug diff --git a/usr.sbin/afs/src/rx/rxdebug.c b/usr.sbin/afs/src/rx/rxdebug.c index 1271de203d8..20c88f07fde 100644 --- a/usr.sbin/afs/src/rx/rxdebug.c +++ b/usr.sbin/afs/src/rx/rxdebug.c @@ -31,16 +31,20 @@ #include <errno.h> #include <string.h> #include <unistd.h> -#include <cmd.h> +#include <agetarg.h> #include <stdio.h> +#include <err.h> #include "rx_user.h" #include "rx_clock.h" #include "rx_queue.h" #include "rx.h" -RCSID ("$Id: rxdebug.c,v 1.1 2000/09/11 14:41:23 art Exp $"); +#include "config.h" +#include "roken.h" + +RCSID ("$KTH: rxdebug.c,v 1.7.2.5 2001/11/24 17:00:58 mattiasa Exp $"); #define TIMEOUT 20 @@ -95,20 +99,32 @@ MakeCall (int asocket, long ahost, short aport, char *adata, bcopy(adata, tp, alen); code = sendto(asocket, tbuffer, alen+sizeof(struct rx_header), 0, (struct sockaddr *)&taddr, sizeof(struct sockaddr_in)); - + if (code == -1) { + err(1, "sendto"); + } /* see if there's a packet available */ + if (asocket >= FD_SETSIZE) { + printf("rxdebug: socket fd too large\n"); + exit (1); + } + FD_ZERO(&imask); FD_SET(asocket,&imask); tv.tv_sec = 1; tv.tv_usec = 0; code = select(asocket+1, &imask, NULL, NULL, &tv); + if (code == -1) { + err(1, "select"); + } if (code > 0) { /* now receive a packet */ faddrLen = sizeof(struct sockaddr_in); code = recvfrom(asocket, tbuffer, sizeof(tbuffer), 0, (struct sockaddr *)&faddr, &faddrLen); - + if (code == -1) { + err(1, "recvfrom"); + } bcopy(tbuffer, &theader, sizeof(struct rx_header)); if (counter == ntohl(theader.callNumber)) break; } @@ -159,7 +175,15 @@ GetVersion(int asocket, long ahost, short aport, void *adata, long alen, code = sendto(asocket, tbuffer, alen+sizeof(struct rx_header), 0, (struct sockaddr *)&taddr, sizeof(struct sockaddr_in)); - + if (code == -1) { + err(1, "sendto"); + } + + if (asocket >= FD_SETSIZE) { + printf("rxdebug: socket fd too large\n"); + exit (1); + } + /* see if there's a packet available */ FD_ZERO(&imask); FD_SET(asocket, &imask); @@ -170,12 +194,18 @@ GetVersion(int asocket, long ahost, short aport, void *adata, long alen, tv.tv_usec = 0; code = select(32, &imask, 0, 0, &tv); + if (code == -1) { + err(1, "select"); + } if (code > 0) { /* now receive a packet */ faddrLen = sizeof(struct sockaddr_in); code = recvfrom(asocket, tbuffer, sizeof(tbuffer), 0, (struct sockaddr *)&faddr, &faddrLen); + if (code == -1) { + err(1, "recvfrom"); + } bcopy(tbuffer, &theader, sizeof(struct rx_header)); @@ -221,8 +251,22 @@ MapOldConn (char version, struct rx_debugConn *tconn) return 0; } +static char *hostName; +static char *portName; +static int nodally; +static int allconns; +static int rxstats; +static char *onlyPortName; +static char *onlyHostName; +static int onlyServer; +static int onlyClient; +static char *onlyAuthName; +static int version_flag; +static int noConns; +static int helpflag; + static int -MainCommand (struct cmd_syndesc *as, void *arock) +MainCommand (void) { register int i; int s; @@ -234,10 +278,6 @@ MainCommand (struct cmd_syndesc *as, void *arock) struct hostent *th; struct rx_debugIn tin; int code; - int nodally; - int allconns; - int rxstats; - int onlyClient, onlyServer; long onlyHost; short onlyPort; int onlyAuth; @@ -248,35 +288,14 @@ MainCommand (struct cmd_syndesc *as, void *arock) int withRxStats; int withWaiters; struct rx_debugStats tstats; - char *portName, *hostName; struct rx_debugConn tconn; - short noConns; - int version_flag; char version[64]; char nada[64]; long length=64; - nodally = (as->parms[2].items ? 1 : 0); - allconns = (as->parms[3].items ? 1 : 0); - rxstats = (as->parms[4].items ? 1 : 0); - onlyServer = (as->parms[5].items ? 1 : 0); - onlyClient = (as->parms[6].items ? 1 : 0); - version_flag=(as->parms[10].items ? 1 : 0); - noConns = (as->parms[11].items ? 1 : 0); - - if (as->parms[0].items) - hostName = as->parms[0].items->data; - else - hostName = (char *) 0; - - if (as->parms[1].items) - portName = as->parms[1].items->data; - else - portName = (char *) 0; - - if (as->parms[7].items) { - char *name = as->parms[7].items->data; + if (onlyPortName) { + char *name = onlyPortName; if ((onlyPort = PortNumber(name)) == -1) onlyPort = PortName(name); if (onlyPort == -1) { @@ -285,8 +304,8 @@ MainCommand (struct cmd_syndesc *as, void *arock) } } else onlyPort = -1; - if (as->parms[8].items) { - char *name = as->parms[8].items->data; + if (onlyHostName) { + char *name = onlyHostName; struct hostent *th; th = gethostbyname(name); if (!th) { @@ -296,8 +315,8 @@ MainCommand (struct cmd_syndesc *as, void *arock) bcopy(th->h_addr, &onlyHost, sizeof(long)); } else onlyHost = -1; - if (as->parms[9].items) { - char *name = as->parms[9].items->data; + if (onlyAuthName) { + char *name = onlyAuthName; if (strcmp (name, "clear") == 0) onlyAuth = 0; else if (strcmp (name, "auth") == 0) onlyAuth = 1; else if (strcmp (name, "crypt") == 0) onlyAuth = 2; @@ -395,17 +414,15 @@ MainCommand (struct cmd_syndesc *as, void *arock) printf("%ld calls waiting for a thread\n", (long)ntohl(tstats.nWaiting)); - if (rxstats) { - if (!withRxStats) { - noRxStats: - withRxStats = 0; + if (rxstats && withRxStats) { + if(!withRxStats) { fprintf (stderr, "WARNING: Server doens't support " "retrieval of Rx statistics\n"); } else { struct rx_stats rxstats; int i; long *lp; - + bzero (&rxstats, sizeof(rxstats)); tin.type = htonl(RX_DEBUGI_RXSTATS); tin.index = 0; @@ -416,22 +433,26 @@ MainCommand (struct cmd_syndesc *as, void *arock) printf("rxstats call failed with code %d\n", code); exit(1); } - if (code != sizeof(rxstats)) { - if ((code == sizeof(tin)) && - (ntohl(((struct rx_debugIn *)(&rxstats))->type) == - RX_DEBUGI_BADTYPE)) goto noRxStats; - fprintf (stderr, "WARNING: returned Rx statistics of " - "unexpected size (got %d)\n", - code); - /* handle other versions?... */ + + if ((code == sizeof(tin)) && + (ntohl(((struct rx_debugIn *)(&rxstats))->type) == + RX_DEBUGI_BADTYPE)) { + fprintf (stderr, "WARNING: Server doens't support " + "retrieval of Rx statistics\n"); + } else { + if (code != sizeof(rxstats)) { + /* handle other versions?... */ + fprintf (stderr, "WARNING: returned Rx statistics of " + "unexpected size (got %d)\n", + code); + } + /* Since its all longs convert to host order with a loop. */ + lp = (long *)&rxstats; + for (i=0; i<sizeof(rxstats)/sizeof(int); i++,lp++) + *lp = ntohl(*lp); + + rx_PrintTheseStats (stdout, &rxstats, sizeof(rxstats)); } - - /* Since its all longs convert to host order with a loop. */ - lp = (long *)&rxstats; - for (i=0; i<sizeof(rxstats)/sizeof(int); i++,lp++) - *lp = ntohl(*lp); - - rx_PrintTheseStats (stdout, &rxstats, sizeof(rxstats)); } } @@ -440,11 +461,7 @@ MainCommand (struct cmd_syndesc *as, void *arock) tin.type = htonl(RX_DEBUGI_GETCONN); if (allconns) { - if (!withAllConn) - fprintf (stderr, "WARNING: Server doesn't support retrieval of " - "all connections,\n" - "getting only interesting instead.\n"); - else tin.type = htonl(RX_DEBUGI_GETALLCONN); + tin.type = htonl(RX_DEBUGI_GETALLCONN); } if (onlyServer) printf ("Showing only server connections\n"); @@ -572,10 +589,10 @@ MainCommand (struct cmd_syndesc *as, void *arock) ((u_long)ntohl(tconn.secStats.expires) - time(0)) / 3600.0); if (!(flags & 1)) { - printf ("\n Received %ld bytes in %ld packets\n", + printf ("\n Received %lu bytes in %lu packets\n", (long)ntohl(tconn.secStats.bytesReceived), (long)ntohl(tconn.secStats.packetsReceived)); - printf (" Sent %ld bytes in %ld packets\n", + printf (" Sent %lu bytes in %lu packets\n", (long)ntohl(tconn.secStats.bytesSent), (long)ntohl(tconn.secStats.packetsSent)); } else @@ -638,33 +655,66 @@ MainCommand (struct cmd_syndesc *as, void *arock) return 0; } +static struct agetargs args[] = { + {"servers", 0, aarg_string, &hostName, + "server machine", NULL, aarg_mandatory}, + {"port", 0, aarg_string, &portName, + "IP port", NULL, aarg_optional_swless }, + {"nodally", 0, aarg_flag, &nodally, + "don't show dallying conns", NULL }, + {"allconnections", 0, aarg_flag, &allconns, + "don't filter out uninteresting connections on server"}, + {"rxstats", 0, aarg_flag, &rxstats, + "show Rx statistics", NULL }, + {"onlyserver", 0, aarg_flag, &onlyServer, + "only show server conns", NULL }, + {"onlyclient", 0, aarg_flag, &onlyClient, + "only show client conns", NULL}, + {"onlyport", 0, aarg_integer, &onlyPortName, + "show only <port>", NULL }, + {"onlyhost", 0, aarg_string, &onlyHostName, + "show only <host>", NULL }, + {"onlyauth", 0, aarg_string, &onlyAuthName, + "show only <auth level>", NULL }, + {"version", 0, aarg_flag, &version_flag, + "show AFS version id", NULL }, + {"noconns", 0, aarg_flag, &noConns, + "show no connections", NULL }, + {NULL} +}; + +static void +usage(void) +{ + aarg_printusage (args, "rxdebug", "", AARG_AFSSTYLE); +} + + /* simple main program */ int main(int argc, char **argv) { - struct cmd_syndesc *ts; - - ts = cmd_CreateSyntax((char *) 0, MainCommand, 0, "probe RX server"); - cmd_AddParm(ts, "-servers", CMD_SINGLE, CMD_REQUIRED, "server machine"); - cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "IP port"); - cmd_AddParm(ts, "-nodally", CMD_FLAG, CMD_OPTIONAL, - "don't show dallying conns"); - cmd_AddParm(ts, "-allconnections", CMD_FLAG, CMD_OPTIONAL, - "don't filter out uninteresting connections on server"); - cmd_AddParm(ts, "-rxstats", CMD_FLAG, CMD_OPTIONAL, "show Rx statistics"); - cmd_AddParm(ts, "-onlyserver", CMD_FLAG, CMD_OPTIONAL, - "only show server conns"); - cmd_AddParm(ts, "-onlyclient", CMD_FLAG, CMD_OPTIONAL, - "only show client conns"); - cmd_AddParm(ts, "-onlyport", CMD_SINGLE, CMD_OPTIONAL, "show only <port>"); - cmd_AddParm(ts, "-onlyhost", CMD_SINGLE, CMD_OPTIONAL, "show only <host>"); - cmd_AddParm(ts, "-onlyauth", CMD_SINGLE, CMD_OPTIONAL, - "show only <auth level>"); - - cmd_AddParm(ts,"-version",CMD_FLAG,CMD_OPTIONAL,"show AFS version id"); - cmd_AddParm(ts,"-noconns",CMD_FLAG,CMD_OPTIONAL,"show no connections"); + + int optind = 0; - cmd_Dispatch(argc, argv); - return 0; + if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) { + usage(); + return 0; + } + + if(helpflag) { + usage(); + return 0; + } + + argc -= optind; + argv += optind; + + if (argc > 0) { + fprintf (stderr, "create volume: unparsed arguments\n"); + return 0; + } + + return MainCommand(); } diff --git a/usr.sbin/afs/src/rx/rxgencon.h b/usr.sbin/afs/src/rx/rxgencon.h index 1dc70aad52a..f3dd9c00dc6 100644 --- a/usr.sbin/afs/src/rx/rxgencon.h +++ b/usr.sbin/afs/src/rx/rxgencon.h @@ -19,7 +19,7 @@ **************************************************************************** */ -/* $Id: rxgencon.h,v 1.2 2000/09/11 14:41:23 art Exp $ */ +/* $KTH: rxgencon.h,v 1.1 1999/02/05 06:09:06 lha Exp $ */ #ifndef _RXGEN_CONSTS_ #define _RXGEN_CONSTS_ diff --git a/usr.sbin/afs/src/rx/rxperf.c b/usr.sbin/afs/src/rx/rxperf.c index 1a535662a8a..2099543525f 100644 --- a/usr.sbin/afs/src/rx/rxperf.c +++ b/usr.sbin/afs/src/rx/rxperf.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -40,7 +35,14 @@ #include <config.h> #endif -RCSID("$Id: rxperf.c,v 1.1 2000/09/11 14:41:23 art Exp $"); +/* + * We are using getopt since we want it to be possible to link to + * transarc libs. + */ + +#ifdef RCSID +RCSID("$KTH: rxperf.c,v 1.3 2000/10/03 00:41:39 lha Exp $"); +#endif #include <sys/types.h> #include <sys/time.h> @@ -56,15 +58,48 @@ RCSID("$Id: rxperf.c,v 1.1 2000/09/11 14:41:23 art Exp $"); #include <strings.h> #include <assert.h> #include <unistd.h> -#include <cmd.h> - -#include <roken.h> -#include <err.h> - +#include <signal.h> +#ifdef HAVE_ERRX +#include <err.h> /* not stricly right, but if we have a errx() there + * is hopefully a err.h */ +#endif #include "rx.h" #include "rx_null.h" -#define DEFAULT_PORT 4711 +#if defined(u_int32) +#define u_int32_t u_int32 +#elif defined(hget32) +#define u_int32_t afs_uint32 +#endif + +static const char *__progname; + +#ifndef HAVE_ERRX +static void +errx(int eval, const char *fmt) +{ + fprintf(stderr, "%s: %s", __progname, fmt); + exit(eval); +} +#endif /* !HAVE_ERRX */ + +#ifndef HAVE_WARNX +static void +warnx(const char *fmt) +{ + fprintf(stderr, "%s: %s", __progname, fmt); +} +#endif /* !HAVE_WARNX */ + +#ifndef HAVE_WARN +static void +warn(const char *fmt) +{ + fprintf(stderr, "%s: %s", __progname, fmt); +} +#endif /* HAVE_WARN */ + +#define DEFAULT_PORT 7009 /* To match tcpdump */ #define DEFAULT_HOST "127.0.0.1" #define DEFAULT_BYTES 1000000 #define RXPERF_BUFSIZE 1400 @@ -126,8 +161,11 @@ str2addr (const char *s) struct in_addr server; struct hostent *h; - if (inet_aton (s, &server) == 1) - return server.s_addr; +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + if (inet_addr(s) != INADDR_NONE) + return inet_addr(s); h = gethostbyname (s); if (h != NULL) { memcpy (&server, h->h_addr_list[0], sizeof(server)); @@ -208,7 +246,7 @@ rxperf_ExecuteRequest(struct rx_call *call) break; case RX_PERF_RECV: default: - warnx ("client sent a unsupported command: %d", command); + warnx ("client sent a unsupported command"); return -1; } return 0; @@ -261,9 +299,10 @@ do_client (const char *server, int port, int32_t bytes) int32_t data; int size; int ret; - char *stamp; + char stamp[1024]; - memset (buf, 0, sizeof(buf)); + for (size = 0; size < RXPERF_BUFSIZE; size++) + buf[size] = rand() >> 3; ret = rx_Init (0); if (ret) @@ -277,7 +316,7 @@ do_client (const char *server, int port, int32_t bytes) secureobj, secureindex); if (conn == NULL) - errx (1, "failed to contact %s", server); + errx (1, "failed to contact server"); call = rx_NewCall (conn); if (call == NULL) @@ -291,7 +330,7 @@ do_client (const char *server, int port, int32_t bytes) if (rx_Write (call, &data, 4) != 4) errx (1, "rx_Write failed to send command"); - asprintf (&stamp, "send %d bytes", bytes); + sprintf (stamp, "send %d bytes", bytes); start_timer(); data = htonl (bytes); @@ -303,13 +342,23 @@ do_client (const char *server, int port, int32_t bytes) if (size > bytes) size = bytes; if (rx_Write (call, buf, size) != size) - errx (1, "failed when %d bytes was left to send", bytes); + errx (1, "failed when bytes where still left to send"); bytes -= size; } if (rx_Read (call, &bytes, 4) != 4) errx (1, "failed to read result from server"); end_and_print_timer (stamp); rx_EndCall (call, 0); + rx_Finalize(); +} + +static void +usage() +{ + fprintf(stderr, "usage: %s (client) -b bytes -p port -s server\n", + __progname); + fprintf(stderr, "usage: %s server -p port\n", __progname); + exit(1); } /* @@ -317,18 +366,24 @@ do_client (const char *server, int port, int32_t bytes) */ static int -rxperf_server (struct cmd_syndesc *as, void *arock) +rxperf_server (int argc, char **argv) { int port = DEFAULT_PORT; - char *portname; char *ptr; + int ch; - if (as->parms[0].items) { - portname = as->parms[1].items->data; - port = strtol (portname, &ptr, 0); - if (ptr && ptr != '\0') + while ((ch = getopt(argc, argv, "p:")) != -1) + switch (ch) { + case 'p': + port = strtol(optarg, &ptr, 0); + if (ptr != 0 && ptr[0] != '\0') errx (1, "can't resolve portname"); - } + break; + default: + usage(); + } + if (optind != argc) + usage(); do_server (htons(port)); @@ -340,32 +395,35 @@ rxperf_server (struct cmd_syndesc *as, void *arock) */ static int -rxperf_client (struct cmd_syndesc *as, void *arock) +rxperf_client (int argc, char **argv) { char *host = DEFAULT_HOST; int bytes = DEFAULT_BYTES; int port = DEFAULT_PORT; - char *numbytes = NULL; - char *portname; char *ptr; + int ch; - if (as->parms[0].items) - host = as->parms[0].items->data; - - if (as->parms[1].items) { - portname = as->parms[1].items->data; - port = strtol (portname, &ptr, 0); - if (ptr && ptr != '\0') + while ((ch = getopt(argc, argv, "b:p:s:")) != -1) + switch (ch) { + case 'b': + bytes = strtol (optarg, &ptr, 0); + if (ptr && *ptr != '\0') + errx (1, "can't resolve number of bytes to transfer"); + break; + case 'p': + port = strtol(optarg, &ptr, 0); + if (ptr != 0 && ptr[0] != '\0') errx (1, "can't resolve portname"); - } + break; + case 's': + host = optarg; + break; + default: + usage(); + } + if (optind != argc) + usage(); - if (as->parms[2].items) { - numbytes = as->parms[2].items->data; - bytes = strtol (numbytes, &ptr, 0); - if (ptr && *ptr != '\0') - errx (1, "can't resolve number of bytes to transfer"); - } - do_client (host, htons(port), bytes); return 0; @@ -378,23 +436,22 @@ rxperf_client (struct cmd_syndesc *as, void *arock) int main(int argc, char **argv) { - struct cmd_syndesc *ts; PROCESS pid; - set_progname (argv[0]); + __progname = strrchr(argv[0], '/'); + if (__progname == 0) + __progname = argv[0]; signal (SIGUSR1, sigusr1); - ts = cmd_CreateSyntax("server", rxperf_server, NULL, "server"); - cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "udp port"); - - ts = cmd_CreateSyntax("client", rxperf_client, NULL, "client"); - cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_OPTIONAL, "server machine"); - cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "udp port"); - cmd_AddParm(ts, "-bytes", CMD_SINGLE, CMD_OPTIONAL, "number of bytes to transfer"); - LWP_InitializeProcessSupport (LWP_NORMAL_PRIORITY, &pid); - cmd_Dispatch(argc, argv); + if (argc >= 2 && strcmp(argv[1], "server") == 0) + rxperf_server(argc - 1, argv + 1); + else if (argc >= 2 && strcmp(argv[1], "client") == 0) + rxperf_client(argc - 1, argv + 1); + else + rxperf_client(argc, argv); return 0; } + diff --git a/usr.sbin/afs/src/rx/test_rx_clock.c b/usr.sbin/afs/src/rx/test_rx_clock.c index c7f2b88e135..25de7814f64 100644 --- a/usr.sbin/afs/src/rx/test_rx_clock.c +++ b/usr.sbin/afs/src/rx/test_rx_clock.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -42,7 +37,7 @@ #include "rx_clock.h" -RCSID("$Id: test_rx_clock.c,v 1.1 2000/09/11 14:41:23 art Exp $"); +RCSID("$KTH: test_rx_clock.c,v 1.3 2000/10/03 00:41:44 lha Exp $"); int main(int argc, char **argv) diff --git a/usr.sbin/afs/src/rxdef/Makefile.in b/usr.sbin/afs/src/rxdef/Makefile.in index e018fc84d54..24c418dd21c 100644 --- a/usr.sbin/afs/src/rxdef/Makefile.in +++ b/usr.sbin/afs/src/rxdef/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:23 art Exp $ +# $KTH: Makefile.in,v 1.48 2000/10/25 07:07:43 lha Exp $ srcdir = @srcdir@ +top_builddir = .. VPATH = @srcdir@ CC = @CC@ @@ -31,7 +32,8 @@ MAKEDEPEND = makedepend DEFINES = INCLUDES = -I../include \ -I$(srcdir)/../include \ - -I$(srcdir)/.. + @INC_roken@ \ + -I$(srcdir)/.. REALCFLAGS = $(INCLUDES) @KRB4_INC_FLAGS@ $(DEFINES) $(CFLAGS) XGFILES = $(srcdir)/vldb.xg \ $(srcdir)/fs.xg \ @@ -190,7 +192,7 @@ clean : mostlyclean: clean distclean: clean - rm -f Makefile config.status + rm -f Makefile *~ realclean: distclean rm -f TAGS diff --git a/usr.sbin/afs/src/rxdef/bos.xg b/usr.sbin/afs/src/rxdef/bos.xg index 6a979917e8d..87575b81337 100644 --- a/usr.sbin/afs/src/rxdef/bos.xg +++ b/usr.sbin/afs/src/rxdef/bos.xg @@ -1,5 +1,5 @@ /* This is -*-c-*- */ -/* $Id: bos.xg,v 1.1 2000/09/11 14:41:24 art Exp $ */ +/* $KTH: bos.xg,v 1.6 2000/08/31 02:46:42 lha Exp $ */ /* * Interface to BOS server @@ -61,6 +61,11 @@ const KTIME_TIME = 0x07; const KTIME_NEVER = 0x10; const KTIME_NOW = 0x20; +/* GetRestartTime */ + +const BOZO_RESTARTTIME_GENERAL = 0x1; /* general reboot time */ +const BOZO_RESTARTTIME_NEWBIN = 0x2; /* new binary */ + #if 0 const GETSTATUS_FSRUN = "file server running"; const GETSTATUS_RSRUNVOLDOWN = "file server running; volser down"; @@ -132,41 +137,41 @@ struct bnode_ops { #endif -CreateBnode (IN string type, - IN string instance, - IN string p1, - IN string p2, - IN string p3, - IN string p4, - IN string p5, - IN string p6) = 80; +CreateBnode (IN string type<BOZO_BSSIZE>, + IN string instance<BOZO_BSSIZE>, + IN string p1<BOZO_BSSIZE>, + IN string p2<BOZO_BSSIZE>, + IN string p3<BOZO_BSSIZE>, + IN string p4<BOZO_BSSIZE>, + IN string p5<BOZO_BSSIZE>, + IN string p6<BOZO_BSSIZE>) = 80; -DeleteBnode (IN string instance) = 81; +DeleteBnode (IN string instance<BOZO_BSSIZE>) = 81; -SetStatus (IN string instance) = 82; +SetStatus (IN string instance<BOZO_BSSIZE>) = 82; -GetStatus (IN string instance, +GetStatus (IN string instance<BOZO_BSSIZE>, OUT long *inStat, OUT string statdescr<BOZO_BSSIZE>) = 83; EnumerateInstance (IN long instance, - OUT string iname) = 84; + OUT string iname<BOZO_BSSIZE>) = 84; -GetInstanceInfo ( IN string instance, - OUT string type<>, - OUT struct bozo_status *status) = 85; +GetInstanceInfo (IN string instance<BOZO_BSSIZE>, + OUT string type<BOZO_BSSIZE>, + OUT struct bozo_status *status) = 85; -GetInstanceParm (IN string instance<>, +GetInstanceParm (IN string instance<BOZO_BSSIZE>, IN long num, - OUT string parm<>) = 86; + OUT string parm<BOZO_BSSIZE>) = 86; -AddSUser (IN string name) = 87; +AddSUser (IN string name<BOZO_BSSIZE>) = 87; -DeleteSUser (IN string name) = 88; +DeleteSUser (IN string name<BOZO_BSSIZE>) = 88; ListSUsers (IN long an, - OUT string name<>) = 89; + OUT string name<BOZO_BSSIZE>) = 89; ListKeys (IN long an, OUT long *kvno, @@ -178,18 +183,18 @@ AddKey (IN long an, DeleteKey (IN long an) = 92; -SetCellName (IN string name) = 93; +SetCellName (IN string name<BOZO_BSSIZE>) = 93; -GetCellName (OUT string name<>) = 94; +GetCellName (OUT string name<BOZO_BSSIZE>) = 94; GetCellHost (IN long awhich, - OUT string name<>) = 95; + OUT string name<BOZO_BSSIZE>) = 95; -AddCellHost (IN string name) = 96; +AddCellHost (IN string name<BOZO_BSSIZE>) = 96; -DeleteCellHost (IN string name) = 97; +DeleteCellHost (IN string name<BOZO_BSSIZE>) = 97; -SetTStatus (IN string instance, +SetTStatus (IN string instance<BOZO_BSSIZE>, IN long status) = 98; ShutdownAll () = 99; @@ -202,24 +207,22 @@ SetNoAuthFlag (IN long flag) = 102; ReBozo () = 103; -Restart (IN string instance) = 104; +Restart (IN string instance<BOZO_BSSIZE>) = 104; -Install (IN string path, +Install (IN string path<BOZO_BSSIZE>, IN long size, IN long flags, - IN long date) = 105; - -/* EndBOZO_Install ? XXX */ + IN long date) split = 105; UnInstall (IN string path) = 106; -GetDates (IN string path, +GetDates (IN string path<BOZO_BSSIZE>, OUT long *newtime, OUT long *baktime, OUT long *oldtime) = 107; -Exec (IN string cmd) = 108; +Exec (IN string cmd<BOZO_BSSIZE>) = 108; Prune (IN long flags) = 109; @@ -231,18 +234,13 @@ SetRestartTime (IN long type, GetRestartTime (IN long type, OUT struct bozo_netKTime *restartTime) = 111; -#if 0 -GetLog 112 -/* the documentation about this call(s?) is/are very confusing/confused */ -#endif +GetLog(IN string name<BOZO_BSSIZE>) split = 112; WaitAll () = 113; GetInstanceStrings (IN string instance, - OUT string errorname<>, - OUT string spare1<>, - OUT string spare2<>, - OUT string spare3<>) = 114; - + OUT string errorname<BOZO_BSSIZE>, + OUT string spare1<BOZO_BSSIZE>, + OUT string spare2<BOZO_BSSIZE>, + OUT string spare3<BOZO_BSSIZE>) = 114; -/* XXX */ diff --git a/usr.sbin/afs/src/rxdef/common.h b/usr.sbin/afs/src/rxdef/common.h index 784744c2fd4..892adf493e1 100644 --- a/usr.sbin/afs/src/rxdef/common.h +++ b/usr.sbin/afs/src/rxdef/common.h @@ -2,7 +2,7 @@ * Common defintions used by several *.xg files */ -/* $Id: common.h,v 1.3 2000/09/11 14:41:24 art Exp $ */ +/* $KTH: common.h,v 1.12 2000/11/03 10:09:48 lha Exp $ */ %#ifndef _COMMON_ %#define _COMMON_ @@ -33,6 +33,8 @@ struct AFSCallBack { enum CallBackType { CBEXCLUSIVE = 1, CBSHARED = 2, CBDROPPED = 3}; +const CALLBACK_VERSION = 1; + struct AFSVolSync { unsigned spare1; unsigned spare2; diff --git a/usr.sbin/afs/src/rxdef/fs.xg b/usr.sbin/afs/src/rxdef/fs.xg index f9ba6c76065..e2523fcca33 100644 --- a/usr.sbin/afs/src/rxdef/fs.xg +++ b/usr.sbin/afs/src/rxdef/fs.xg @@ -1,6 +1,6 @@ /* This is -*-c-*- */ -/* $Id: fs.xg,v 1.3 2000/09/11 14:41:24 art Exp $ */ +/* $KTH: fs.xg,v 1.13 2000/04/30 10:14:25 assar Exp $ */ /* * Interface to FS diff --git a/usr.sbin/afs/src/rxdef/ka.xg b/usr.sbin/afs/src/rxdef/ka.xg index 85f121b72ca..f1f30d9b31f 100644 --- a/usr.sbin/afs/src/rxdef/ka.xg +++ b/usr.sbin/afs/src/rxdef/ka.xg @@ -98,19 +98,22 @@ const KALOCKED = 180522; struct ka_CBS { - char Seq<>; + opaque Seq<>; }; struct ka_BBS { int32_t MaxSeqLen; - char Seq<>; + opaque Seq<>; }; struct EncryptionKey { char key[8]; }; +const MAXKANAMELEN = 64; #define MAXKANAMELEN 64 +const MAXKTCTICKETLEN = 344; +const KA_LABELSIZE = 4; typedef string kaname<MAXKANAMELEN>; @@ -142,6 +145,7 @@ Authenticate (IN kaname name, IN kaname instance, IN Date start_time, IN Date end_time, + IN ka_CBS *request, INOUT ka_BBS *answer) = 21; ChangePassword (IN kaname name, @@ -175,3 +179,21 @@ GetEntry (IN kaname name, OUT kaentryinfo *entry) = 8; +package KAT_ + +GetTicket_old (IN int32_t kvno, + IN kaname auth_domain, + IN struct ka_CBS *aticket, + IN kaname name, + IN kaname instance, + IN struct ka_CBS *atimes, + INOUT struct ka_BBS *oanswer) = 3; + +GetTicket (IN int32_t kvno, + IN kaname auth_domain, + IN struct ka_CBS *aticket, + IN kaname name, + IN kaname instance, + IN struct ka_CBS *atimes, + INOUT struct ka_BBS *oanswer) = 23; + diff --git a/usr.sbin/afs/src/rxdef/pts.xg b/usr.sbin/afs/src/rxdef/pts.xg index 20a4f71e82c..5d2fb931775 100644 --- a/usr.sbin/afs/src/rxdef/pts.xg +++ b/usr.sbin/afs/src/rxdef/pts.xg @@ -293,7 +293,7 @@ GetCPS(IN long id, ListOwned(IN long id, OUT prlist *elist, - OUT long *over) = 517; + INOUT long *over) = 517; IsAMemberOf(IN long uid, IN long gid, diff --git a/usr.sbin/afs/src/rxdef/ubik.xg b/usr.sbin/afs/src/rxdef/ubik.xg index e2dabbb44d4..dac783ff270 100644 --- a/usr.sbin/afs/src/rxdef/ubik.xg +++ b/usr.sbin/afs/src/rxdef/ubik.xg @@ -1,7 +1,7 @@ /* -*- C -*- */ /* - * $Id: ubik.xg,v 1.3 2000/09/11 14:41:24 art Exp $ + * $KTH: ubik.xg,v 1.8 2000/03/14 22:28:12 assar Exp $ */ package Ubik_ diff --git a/usr.sbin/afs/src/rxdef/vldb.xg b/usr.sbin/afs/src/rxdef/vldb.xg index 7ce1aef0c12..5364cb3c921 100644 --- a/usr.sbin/afs/src/rxdef/vldb.xg +++ b/usr.sbin/afs/src/rxdef/vldb.xg @@ -393,7 +393,7 @@ GetEntryByNameN (IN string volumename<VLDB_MAXNAMELEN>, ReplaceEntryN (IN long Volid, IN long voltype, - IN vldbentry *newentry, + IN nvldbentry *newentry, IN long ReleaseType) = 520; ListEntryN() = 521; diff --git a/usr.sbin/afs/src/rxdef/volumeserver.xg b/usr.sbin/afs/src/rxdef/volumeserver.xg index bf02de1b4fa..e67ec1cb029 100644 --- a/usr.sbin/afs/src/rxdef/volumeserver.xg +++ b/usr.sbin/afs/src/rxdef/volumeserver.xg @@ -2,7 +2,7 @@ * Interface to Volumeserver, * reference /afs/nada.kth.se/misc/reference/programming/afs/shadow/ * - * $Id: volumeserver.xg,v 1.3 2000/09/11 14:41:25 art Exp $ + * $KTH: volumeserver.xg,v 1.20 2000/06/01 23:59:02 ahltorp Exp $ */ package VOLSER_ diff --git a/usr.sbin/afs/src/rxkad/Makefile.in b/usr.sbin/afs/src/rxkad/Makefile.in index 9c45402e6a3..e4ea4bccd40 100644 --- a/usr.sbin/afs/src/rxkad/Makefile.in +++ b/usr.sbin/afs/src/rxkad/Makefile.in @@ -1,11 +1,12 @@ # -# $Id: Makefile.in,v 1.1 2000/09/11 14:41:25 art Exp $ +# $KTH: Makefile.in,v 1.18 2000/10/08 06:24:12 lha Exp $ # # This should really be set from configure SHELL = /bin/sh srcdir = @srcdir@ +top_builddir = .. VPATH = @srcdir@ CC = @CC@ diff --git a/usr.sbin/afs/src/rxkad/compat.c b/usr.sbin/afs/src/rxkad/compat.c index 1aa0c4e5974..902d71f7e00 100644 --- a/usr.sbin/afs/src/rxkad/compat.c +++ b/usr.sbin/afs/src/rxkad/compat.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "rxkad_locl.h" -RCSID("$Id: compat.c,v 1.2 2000/09/11 14:41:25 art Exp $"); +RCSID("$KTH: compat.c,v 1.5 2000/10/03 00:38:11 lha Exp $"); void initialize_rxk_error_table(void); diff --git a/usr.sbin/afs/src/rxkad/osi_alloc.c b/usr.sbin/afs/src/rxkad/osi_alloc.c index 6c6468342cb..76b515c747b 100644 --- a/usr.sbin/afs/src/rxkad/osi_alloc.c +++ b/usr.sbin/afs/src/rxkad/osi_alloc.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "rxkad_locl.h" -RCSID("$Id: osi_alloc.c,v 1.2 2000/09/11 14:41:25 art Exp $"); +RCSID("$KTH: osi_alloc.c,v 1.4 2000/10/03 00:38:16 lha Exp $"); #undef osi_Alloc #undef osi_Free diff --git a/usr.sbin/afs/src/rxkad/rxk_clnt.c b/usr.sbin/afs/src/rxkad/rxk_clnt.c index 5606bb482a6..06117be55bc 100644 --- a/usr.sbin/afs/src/rxkad/rxk_clnt.c +++ b/usr.sbin/afs/src/rxkad/rxk_clnt.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "rxkad_locl.h" -RCSID("$Id: rxk_clnt.c,v 1.3 2000/09/11 14:41:25 art Exp $"); +RCSID("$KTH: rxk_clnt.c,v 1.7 2000/10/03 00:38:22 lha Exp $"); /* This code also links into the kernel so we need to use osi_Alloc() * to avoid calling malloc(). Similar trick with memcpy() */ diff --git a/usr.sbin/afs/src/rxkad/rxk_crpt.c b/usr.sbin/afs/src/rxkad/rxk_crpt.c index 67c1e613c01..263925aeda2 100644 --- a/usr.sbin/afs/src/rxkad/rxk_crpt.c +++ b/usr.sbin/afs/src/rxkad/rxk_crpt.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -58,7 +53,7 @@ # endif #endif -RCSID("$Id: rxk_crpt.c,v 1.3 2000/09/11 14:41:25 art Exp $"); +RCSID("$KTH: rxk_crpt.c,v 1.12 2000/10/03 00:38:27 lha Exp $"); /* * Unrolling of the inner loops helps the most on pentium chips diff --git a/usr.sbin/afs/src/rxkad/rxk_info.c b/usr.sbin/afs/src/rxkad/rxk_info.c index 5ec41dafd94..4a6a454a275 100644 --- a/usr.sbin/afs/src/rxkad/rxk_info.c +++ b/usr.sbin/afs/src/rxkad/rxk_info.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "rxkad_locl.h" -RCSID("$Id: rxk_info.c,v 1.2 2000/09/11 14:41:25 art Exp $"); +RCSID("$KTH: rxk_info.c,v 1.4 2000/10/03 00:38:33 lha Exp $"); int32 rxkad_GetServerInfo(struct rx_connection *con, diff --git a/usr.sbin/afs/src/rxkad/rxk_locl.c b/usr.sbin/afs/src/rxkad/rxk_locl.c index 0d92e02d2a7..f27b623aa96 100644 --- a/usr.sbin/afs/src/rxkad/rxk_locl.c +++ b/usr.sbin/afs/src/rxkad/rxk_locl.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ #include "rxkad_locl.h" -RCSID("$Id: rxk_locl.c,v 1.2 2000/09/11 14:41:25 art Exp $"); +RCSID("$KTH: rxk_locl.c,v 1.8 2000/10/03 00:38:38 lha Exp $"); /* The header checksum is the last 16 bits of this struct after * encryption. Note that only the last 8 bytes change per packet. */ diff --git a/usr.sbin/afs/src/rxkad/rxk_serv.c b/usr.sbin/afs/src/rxkad/rxk_serv.c index d0eb29fdf46..2e18608f773 100644 --- a/usr.sbin/afs/src/rxkad/rxk_serv.c +++ b/usr.sbin/afs/src/rxkad/rxk_serv.c @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -42,7 +37,7 @@ #include <krb5.h> #endif -RCSID("$Id: rxk_serv.c,v 1.3 2000/09/11 14:41:25 art Exp $"); +RCSID("$KTH: rxk_serv.c,v 1.6 2000/10/03 00:38:44 lha Exp $"); /* Security object specific server data */ typedef struct rxkad_serv_class { diff --git a/usr.sbin/afs/src/rxkad/rxkad.h b/usr.sbin/afs/src/rxkad/rxkad.h index b4110712b9f..2b617dad87f 100644 --- a/usr.sbin/afs/src/rxkad/rxkad.h +++ b/usr.sbin/afs/src/rxkad/rxkad.h @@ -1,7 +1,7 @@ /* -*- C -*- */ /* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -16,12 +16,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,7 +33,7 @@ * SUCH DAMAGE. */ -/* @(#)$Id: rxkad.h,v 1.4 2002/02/17 19:42:35 millert Exp $ */ +/* @(#)$KTH: rxkad.h,v 1.8.2.1 2001/10/03 22:55:31 assar Exp $ */ #ifndef __RXKAD_H #define __RXKAD_H @@ -65,31 +60,35 @@ extern int rxkad_min_level; /* enforce min level at client end */ extern int rxkad_EpochWasSet; -int32 rxkad_GetServerInfo(struct rx_connection *con, - rxkad_level *level, - u_int32 *expiration, - char *name, - char *instance, - char *cell, - int32 *kvno); +#ifndef __P +#define __P(x) x +#endif + +int32 rxkad_GetServerInfo __P((struct rx_connection *con, + rxkad_level *level, + u_int32 *expiration, + char *name, + char *instance, + char *cell, + int32 *kvno)); struct rx_securityClass * -rxkad_NewServerSecurityObject(/*rxkad_level*/ int min_level, - void *appl_data, - int (*get_key)(void *appl_data, - int kvno, - des_cblock *key), - int (*user_ok)(char *name, - char *inst, - char *realm, - int kvno)); +rxkad_NewServerSecurityObject __P((/*rxkad_level*/ int min_level, + void *appl_data, + int (*get_key)(void *appl_data, + int kvno, + des_cblock *key), + int (*user_ok)(char *name, + char *inst, + char *realm, + int kvno))); struct rx_securityClass * -rxkad_NewClientSecurityObject(/*rxkad_level*/ int level, - void *sessionkey, - int32 kvno, - int ticketLen, - char *ticket); +rxkad_NewClientSecurityObject __P((/*rxkad_level*/ int level, + void *sessionkey, + int32 kvno, + int ticketLen, + char *ticket)); #define RXKADINCONSISTENCY (19270400L) #define RXKADPACKETSHORT (19270401L) @@ -117,6 +116,10 @@ rxkad_NewClientSecurityObject(/*rxkad_level*/ int level, #define MAXKTCREALMLEN REALM_SZ */ +#ifndef CLOCK_SKEW +#define CLOCK_SKEW (5*60) +#endif + #define KTC_TIME_UNCERTAINTY (CLOCK_SKEW) /* @@ -133,32 +136,32 @@ struct ktc_principal { char cell[MAXKTCREALMLEN]; }; -u_int32 life_to_time(u_int32 start, int life_); +u_int32 life_to_time __P((u_int32 start, int life_)); -int time_to_life(u_int32 start, u_int32 end); +int time_to_life __P((u_int32 start, u_int32 end)); -int tkt_CheckTimes(int32 begin, int32 end, int32 now); +int tkt_CheckTimes __P((int32 begin, int32 end, int32 now)); int -tkt_MakeTicket(char *ticket, - int *ticketLen, - struct ktc_encryptionKey *key, - char *name, char *inst, char *cell, - u_int32 start, u_int32 end, - struct ktc_encryptionKey *sessionKey, - u_int32 host, - char *sname, char *sinst); +tkt_MakeTicket __P((char *ticket, + int *ticketLen, + struct ktc_encryptionKey *key, + char *name, char *inst, char *cell, + u_int32 start, u_int32 end, + struct ktc_encryptionKey *sessionKey, + u_int32 host, + char *sname, char *sinst)); int -tkt_DecodeTicket(char *asecret, - int32 ticketLen, - struct ktc_encryptionKey *key, - char *name, - char *inst, - char *cell, - char *sessionKey, - int32 *host, - int32 *start, - int32 *end); +tkt_DecodeTicket __P((char *asecret, + int32 ticketLen, + struct ktc_encryptionKey *key, + char *name, + char *inst, + char *cell, + char *sessionKey, + int32 *host, + int32 *start, + int32 *end)); #endif /* __RXKAD_H */ diff --git a/usr.sbin/afs/src/rxkad/rxkad_locl.h b/usr.sbin/afs/src/rxkad/rxkad_locl.h index 9a420cb75d1..fa480af5dc7 100644 --- a/usr.sbin/afs/src/rxkad/rxkad_locl.h +++ b/usr.sbin/afs/src/rxkad/rxkad_locl.h @@ -14,12 +14,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors + * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,12 +31,12 @@ * SUCH DAMAGE. */ -/* @(#)$Id: rxkad_locl.h,v 1.3 2000/09/11 14:41:26 art Exp $ */ +/* @(#)$KTH: rxkad_locl.h,v 1.10 2000/10/03 00:38:55 lha Exp $ */ #ifndef __RXKAD_LOCL_H #define __RXKAD_LOCL_H -/* $Id: rxkad_locl.h,v 1.3 2000/09/11 14:41:26 art Exp $ */ +/* $KTH: rxkad_locl.h,v 1.10 2000/10/03 00:38:55 lha Exp $ */ #ifdef HAVE_CONFIG_H #include <config.h> |