summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHans Insulander <hin@cvs.openbsd.org>2003-08-05 08:47:47 +0000
committerHans Insulander <hin@cvs.openbsd.org>2003-08-05 08:47:47 +0000
commit72d37ad63376c9e81f32057a859adbe3c5b591bc (patch)
tree21388a5f7ad4fcfc71c5d5ebe0bc0df8b1757836 /usr.sbin
parent3f898bc9738b2b9e412ef593b11fc317e854a360 (diff)
Merge
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/afs/src/lib/acl/acl.h2
-rw-r--r--usr.sbin/afs/src/lib/acl/acl_files.c2
-rw-r--r--usr.sbin/afs/src/lib/bufdir/afs_dir.h28
-rw-r--r--usr.sbin/afs/src/lib/bufdir/fbuf.c93
-rw-r--r--usr.sbin/afs/src/lib/bufdir/fbuf.h12
-rw-r--r--usr.sbin/afs/src/lib/bufdir/fdir.c190
-rw-r--r--usr.sbin/afs/src/lib/bufdir/fdir.h13
-rw-r--r--usr.sbin/afs/src/lib/editline/ChangeLog5
-rw-r--r--usr.sbin/afs/src/lib/editline/README2
-rw-r--r--usr.sbin/afs/src/lib/editline/complete.c2
-rw-r--r--usr.sbin/afs/src/lib/editline/edit_compat.c2
-rw-r--r--usr.sbin/afs/src/lib/editline/editline.32
-rw-r--r--usr.sbin/afs/src/lib/editline/editline.c2
-rw-r--r--usr.sbin/afs/src/lib/editline/editline.h2
-rw-r--r--usr.sbin/afs/src/lib/editline/sysunix.c2
-rw-r--r--usr.sbin/afs/src/lib/editline/testit.c2
-rw-r--r--usr.sbin/afs/src/lib/editline/unix.h2
-rw-r--r--usr.sbin/afs/src/lib/ko/afsconf.c2
-rw-r--r--usr.sbin/afs/src/lib/ko/agetarg.c18
-rw-r--r--usr.sbin/afs/src/lib/ko/auth.c19
-rw-r--r--usr.sbin/afs/src/lib/ko/auth.h4
-rw-r--r--usr.sbin/afs/src/lib/ko/cellconfig.h2
-rw-r--r--usr.sbin/afs/src/lib/ko/gensysname.c31
-rw-r--r--usr.sbin/afs/src/lib/ko/ko.h30
-rw-r--r--usr.sbin/afs/src/lib/ko/ko_locl.h16
-rw-r--r--usr.sbin/afs/src/lib/ko/kocell.c440
-rw-r--r--usr.sbin/afs/src/lib/ko/koerror.c42
-rw-r--r--usr.sbin/afs/src/lib/ko/kotest.c6
-rw-r--r--usr.sbin/afs/src/lib/ko/part.c2
-rw-r--r--usr.sbin/afs/src/lib/ko/part.h2
-rw-r--r--usr.sbin/afs/src/lib/ko/ports.c2
-rw-r--r--usr.sbin/afs/src/lib/ko/ports.h2
-rw-r--r--usr.sbin/afs/src/lib/ko/vlmisc.c83
-rw-r--r--usr.sbin/afs/src/lib/sl/ChangeLog8
-rw-r--r--usr.sbin/afs/src/lib/sl/lex.l2
-rw-r--r--usr.sbin/afs/src/lib/sl/make_cmds.c6
-rw-r--r--usr.sbin/afs/src/lib/sl/make_cmds.h2
-rw-r--r--usr.sbin/afs/src/lib/sl/parse.y2
-rw-r--r--usr.sbin/afs/src/lib/sl/sl.c6
-rw-r--r--usr.sbin/afs/src/lib/sl/sl.h2
-rw-r--r--usr.sbin/afs/src/lib/sl/sl_locl.h2
-rw-r--r--usr.sbin/afs/src/lib/sl/ss.c2
-rw-r--r--usr.sbin/afs/src/lib/sl/ss.h2
43 files changed, 776 insertions, 322 deletions
diff --git a/usr.sbin/afs/src/lib/acl/acl.h b/usr.sbin/afs/src/lib/acl/acl.h
index cd4fe41f7c6..9895c1c5290 100644
--- a/usr.sbin/afs/src/lib/acl/acl.h
+++ b/usr.sbin/afs/src/lib/acl/acl.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: acl.h,v 1.5 2000/10/03 00:28:33 lha Exp $ */
+/* $arla: acl.h,v 1.5 2000/10/03 00:28:33 lha Exp $ */
#ifndef __ACL_H
#define __ACL_H
diff --git a/usr.sbin/afs/src/lib/acl/acl_files.c b/usr.sbin/afs/src/lib/acl/acl_files.c
index 98a84d2794b..ccc17d1822e 100644
--- a/usr.sbin/afs/src/lib/acl/acl_files.c
+++ b/usr.sbin/afs/src/lib/acl/acl_files.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "config.h"
-RCSID("$KTH: acl_files.c,v 1.5 1999/09/09 23:46:01 assar Exp $");
+RCSID("$arla: acl_files.c,v 1.5 1999/09/09 23:46:01 assar Exp $");
#ifdef KERBEROS
diff --git a/usr.sbin/afs/src/lib/bufdir/afs_dir.h b/usr.sbin/afs/src/lib/bufdir/afs_dir.h
index 5fd7d1bfb40..5e49f68ad3a 100644
--- a/usr.sbin/afs/src/lib/bufdir/afs_dir.h
+++ b/usr.sbin/afs/src/lib/bufdir/afs_dir.h
@@ -35,7 +35,7 @@
* The directory structure used by AFS.
*/
-/* $KTH: afs_dir.h,v 1.6 2000/10/02 22:59:28 lha Exp $ */
+/* $arla: afs_dir.h,v 1.8 2002/03/19 12:21:25 tol Exp $ */
#ifndef _AFS_DIR_
#define _AFS_DIR_
@@ -44,6 +44,8 @@
#define ADIRHASHSIZE 128
#define ENTRIESPERPAGE 64
+#define AFSDIR_FIRST 1
+
/* number of pages in map */
#define MAXPAGES 128
@@ -54,19 +56,19 @@
*/
typedef struct {
- u_int32_t Vnode;
- u_int32_t Unique;
+ uint32_t Vnode;
+ uint32_t Unique;
} DirFid;
typedef struct {
union {
struct {
- u_int16_t pgcount;
- u_int16_t tag; /* Should be 1234 in net-order */
- u_int8_t freecount;
- u_int8_t bitmap[ENTRIESPERPAGE / 8];
+ uint16_t pgcount;
+ uint16_t tag; /* Should be 1234 in net-order */
+ uint8_t freecount;
+ uint8_t bitmap[ENTRIESPERPAGE / 8];
} s;
- u_int8_t pad[32];
+ uint8_t pad[32];
} u;
} PageHeader;
@@ -78,14 +80,14 @@ typedef struct {
#define pg_bitmap u.s.bitmap
typedef struct {
- u_int8_t map[MAXPAGES];
- u_int16_t hash[ADIRHASHSIZE];
+ uint8_t map[MAXPAGES];
+ uint16_t hash[ADIRHASHSIZE];
} DirHeader;
typedef struct {
- u_int8_t flag;
- u_int8_t length;
- u_int16_t next;
+ uint8_t flag;
+ uint8_t length;
+ uint16_t next;
DirFid fid;
char name[16]; /* If name overflows into fill, then we */
char fill[4]; /* should use next entry too. */
diff --git a/usr.sbin/afs/src/lib/bufdir/fbuf.c b/usr.sbin/afs/src/lib/bufdir/fbuf.c
index a79914db75d..65d29eaee95 100644
--- a/usr.sbin/afs/src/lib/bufdir/fbuf.c
+++ b/usr.sbin/afs/src/lib/bufdir/fbuf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
#include <config.h>
-RCSID("$KTH: fbuf.c,v 1.13.2.3 2001/10/24 01:35:22 ahltorp Exp $") ;
+RCSID("$arla: fbuf.c,v 1.22 2003/01/23 10:34:55 tol Exp $") ;
#include <stdio.h>
#include <stdlib.h>
@@ -54,6 +54,12 @@ RCSID("$KTH: fbuf.c,v 1.13.2.3 2001/10/24 01:35:22 ahltorp Exp $") ;
#ifdef HAVE_MMAP
+/*
+ * mmap version of the fbuf interface, the mmap_copy{rx2fd,fd2rx} are
+ * little complicated to support reading/writing on non page
+ * bonderies.
+ */
+
#if !defined(MAP_FAILED)
#define MAP_FAILED ((void *)(-1))
#endif
@@ -160,6 +166,12 @@ mmap_end (fbuf *f)
}
/*
+ *
+ */
+
+static size_t mmap_max_size = 10 * 1024 * 1024;
+
+/*
* Copy `len' bytes from the rx call `call' to the file `fd'.
* Returns 0 or error
*/
@@ -170,21 +182,41 @@ mmap_copyrx2fd (struct rx_call *call, int fd, off_t off, size_t len)
void *buf;
int r_len;
int ret = 0;
-
+ off_t adjust_off, adjust_len;
+ size_t size;
+
if (len == 0)
return 0;
- buf = mmap (0, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, off);
- if (buf == (void *) MAP_FAILED)
- return errno;
- r_len = rx_Read (call, buf, len);
- if (r_len != len)
- ret = conv_to_arla_errno(rx_Error(call));
+ /* padding */
+ adjust_off = off % getpagesize();
- if (msync (buf, len, MS_ASYNC))
- ret = errno;
- if (munmap (buf, len))
- ret = errno;
+ while (len > 0) {
+
+ size = min(len + adjust_off, mmap_max_size);
+ adjust_len = getpagesize() - (size % getpagesize());
+
+ buf = mmap (0, size + adjust_len,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd, off - adjust_off);
+ if (buf == (void *) MAP_FAILED)
+ return errno;
+ r_len = rx_Read (call, ((char *) buf) + adjust_off, size - adjust_off);
+ if (r_len != size - adjust_off)
+ ret = conv_to_arla_errno(rx_GetCallError(call));
+
+ len -= r_len;
+ off += r_len;
+ adjust_off = 0;
+
+ if (msync (buf, size + adjust_len, MS_ASYNC))
+ ret = errno;
+ if (munmap (buf, size + adjust_len))
+ ret = errno;
+
+ if (ret)
+ break;
+ }
return ret;
}
@@ -198,21 +230,38 @@ static int
mmap_copyfd2rx (int fd, struct rx_call *call, off_t off, size_t len)
{
void *buf;
- int r_write;
+ int w_len;
int ret = 0;
+ off_t adjust_off, adjust_len;
+ size_t size;
if (len == 0)
return 0;
- buf = mmap (0, len, PROT_READ, MAP_PRIVATE, fd, off);
- if (buf == (void *) MAP_FAILED)
- return errno;
- r_write = rx_Write (call, buf, len);
- if (r_write != len)
- ret = conv_to_arla_errno(rx_Error(call));
+ adjust_off = off % getpagesize();
- if (munmap (buf, len))
- ret = errno;
+ while (len > 0) {
+
+ size = min(len + adjust_off, mmap_max_size);
+ adjust_len = size % getpagesize();
+
+ buf = mmap (0, size + adjust_len,
+ PROT_READ, MAP_PRIVATE, fd, off - adjust_off);
+ if (buf == (void *) MAP_FAILED)
+ return errno;
+ w_len = rx_Write (call, (char *)buf + adjust_off, size - adjust_off);
+ if (w_len != size - adjust_off)
+ ret = conv_to_arla_errno(rx_GetCallError(call));
+
+ len -= w_len;
+ off += w_len;
+ adjust_off = 0;
+
+ if (munmap (buf, size + adjust_len))
+ ret = errno;
+ if (ret)
+ break;
+ }
return ret;
}
diff --git a/usr.sbin/afs/src/lib/bufdir/fbuf.h b/usr.sbin/afs/src/lib/bufdir/fbuf.h
index e89caa2955b..2dc2c1cf405 100644
--- a/usr.sbin/afs/src/lib/bufdir/fbuf.h
+++ b/usr.sbin/afs/src/lib/bufdir/fbuf.h
@@ -31,12 +31,14 @@
* SUCH DAMAGE.
*/
-/* $KTH: fbuf.h,v 1.6 2000/10/02 22:59:38 lha Exp $ */
+/* $arla: fbuf.h,v 1.8 2002/09/07 10:44:06 lha Exp $ */
#ifndef _FBUF_H_
#define _FBUF_H_
+#ifndef _KERNEL
#include <rx/rx.h>
+#endif
typedef enum {
FBUF_READ = 0x01,
@@ -54,13 +56,19 @@ struct fbuf {
typedef struct fbuf fbuf;
+#ifdef _KERNEL
+int fbuf_create (fbuf *fbuf, NNPFS_FBUF_HANDLE fd, size_t len, fbuf_flags flags);
+#else
int fbuf_create (fbuf *fbuf, int fd, size_t len, fbuf_flags flags);
+#endif
+
int fbuf_truncate (fbuf *fbuf, size_t new_len);
int fbuf_end (fbuf *fbuf);
size_t fbuf_len (fbuf *f);
void *fbuf_buf (fbuf *f);
+#ifndef _KERNEL
int copyrx2fd (struct rx_call *call, int fd, off_t off, size_t len);
int copyfd2rx (int fd, struct rx_call *call, off_t off, size_t len);
-
+#endif
#endif /* _FBUF_H_ */
diff --git a/usr.sbin/afs/src/lib/bufdir/fdir.c b/usr.sbin/afs/src/lib/bufdir/fdir.c
index 3c453e0e90e..604d9a7a02e 100644
--- a/usr.sbin/afs/src/lib/bufdir/fdir.c
+++ b/usr.sbin/afs/src/lib/bufdir/fdir.c
@@ -35,9 +35,10 @@
* Routines for reading an AFS directory
*/
+#ifndef _KERNEL
#include <config.h>
-RCSID("$KTH: fdir.c,v 1.9 2000/10/02 22:59:43 lha Exp $") ;
+RCSID("$arla: fdir.c,v 1.14 2003/02/04 17:09:04 lha Exp $") ;
#include <sys/types.h>
#include <sys/errno.h>
@@ -45,6 +46,10 @@ RCSID("$KTH: fdir.c,v 1.9 2000/10/02 22:59:43 lha Exp $") ;
#include <unistd.h>
#include <assert.h>
#include <rx/rx.h>
+#else
+#include <nnpfs_locl.h>
+#endif
+
#include <afs_dir.h>
#include <fdir.h>
@@ -116,12 +121,12 @@ static DirEntry *
find_entry(DirPage0 *page0, const char *name)
{
DirEntry *entry;
- unsigned i;
+ unsigned short i;
for (i = ntohs(page0->dheader.hash[hashentry (name)]);
i != 0;
i = ntohs(entry->next)) {
- entry = getentry (page0, i - 1);
+ entry = getentry (page0, (unsigned short)(i - 1));
if (strcmp (entry->name, name) == 0)
return entry;
@@ -153,6 +158,53 @@ find_by_name (DirPage0 *page0,
}
/*
+ * Return true if slot `off' on `page' is being used.
+ */
+
+static int
+used_slot (DirPage1 *page, int off)
+{
+ return page->header.pg_bitmap[off / 8] & (1 << (off % 8));
+}
+
+/*
+ * Return true if slot w/ index `off' on `page' is a valid entry.
+ */
+
+static int
+first_slotp (DirPage1 *page, int off)
+{
+ DirEntry *entry = &page->entry[off];
+ if (used_slot(page, off + 1)
+ && entry->flag == AFSDIR_FIRST)
+ return TRUE;
+
+ return FALSE;
+}
+
+/*
+ * Is this page `pageno' empty?
+ */
+
+static int
+is_page_empty (DirPage0 *page0, unsigned pageno)
+{
+ DirPage1 *page;
+ int i;
+
+ if (pageno < MAXPAGES)
+ return page0->dheader.map[pageno] == ENTRIESPERPAGE - 1;
+ page = getpage (page0, pageno);
+ if (page->header.pg_bitmap[0] != 1)
+ return 0;
+ for (i = 1; i < sizeof(page->header.pg_bitmap); ++i)
+ if (page->header.pg_bitmap[i] != 0)
+ return 0;
+ return 1;
+}
+
+#ifndef _KERNEL
+/*
* Change the fid for `name' to `fid'. Return 0 or -1.
*/
@@ -172,16 +224,6 @@ update_fid_by_name (DirPage0 *page0,
}
/*
- * Return true if slot `off' on `page' is being used.
- */
-
-static int
-used_slot (DirPage1 *page, int off)
-{
- return page->header.pg_bitmap[off / 8] & (1 << (off % 8));
-}
-
-/*
* Mark slot `off' on `page' as being used.
*/
@@ -202,27 +244,6 @@ set_unused (DirPage1 *page, int off)
}
/*
- * Is this page `pageno' empty?
- */
-
-static int
-is_page_empty (DirPage0 *page0, unsigned pageno)
-{
- DirPage1 *page;
- int i;
-
- if (pageno < MAXPAGES)
- return page0->dheader.map[pageno] == ENTRIESPERPAGE - 1;
- page = getpage (page0, pageno);
- if (page->header.pg_bitmap[0] != 1)
- return 0;
- for (i = 1; i < sizeof(page->header.pg_bitmap); ++i)
- if (page->header.pg_bitmap[i] != 0)
- return 0;
- return 1;
-}
-
-/*
* Add a new page to the directory in `the_fbuf', returning a pointer
* to the new page in `ret_page'.
* Return 0 iff succesful.
@@ -282,7 +303,7 @@ add_to_page (DirPage0 *page0,
for (k = i + 1; k < i + j + 1; ++k)
page->header.pg_bitmap[k / 8] |= (1 << (k % 8));
- page->entry[i].flag = 1;
+ page->entry[i].flag = AFSDIR_FIRST;
page->entry[i].length = 0;
page->entry[i].next = next;
page->entry[i].fid.Vnode = htonl(fid.Vnode);
@@ -326,28 +347,6 @@ remove_from_page (DirPage0 *page0,
return 0;
}
-/*
- * Lookup `name' in the AFS directory identified by `dir' and return
- * the Fid in `file'. Return value is 0 or error code.
- */
-
-int
-fdir_lookup (fbuf *the_fbuf, const VenusFid *dir,
- const char *name, VenusFid *file)
-{
- DirPage0 *page0;
- unsigned ind;
-
- page0 = (DirPage0 *)fbuf_buf(the_fbuf);
- assert (page0);
- ind = find_by_name (page0, name, file, dir);
-
- if (ind == 0)
- return 0;
- else
- return ENOENT;
-}
-
/*
* Lookup `name' in the AFS directory identified by `dir' and change the
* fid to `fid'.
@@ -370,6 +369,29 @@ fdir_changefid (fbuf *the_fbuf,
else
return ENOENT;
}
+#endif
+
+/*
+ * Lookup `name' in the AFS directory identified by `dir' and return
+ * the Fid in `file'. Return value is 0 or error code.
+ */
+
+int
+fdir_lookup (fbuf *the_fbuf, const VenusFid *dir,
+ const char *name, VenusFid *file)
+{
+ DirPage0 *page0;
+ unsigned ind;
+
+ page0 = (DirPage0 *)fbuf_buf(the_fbuf);
+ assert (page0);
+ ind = find_by_name (page0, name, file, dir);
+
+ if (ind == 0)
+ return 0;
+ else
+ return ENOENT;
+}
/*
* Return TRUE if dir is empty.
@@ -398,13 +420,16 @@ int
fdir_readdir (fbuf *the_fbuf,
fdir_readdir_func func,
void *arg,
- const VenusFid *dir)
+ VenusFid dir,
+ uint32_t *offset)
{
DirPage0 *page0;
unsigned i, j;
VenusFid fid;
unsigned len = fbuf_len(the_fbuf);
unsigned npages;
+ unsigned first_slot;
+ int ret;
page0 = (DirPage0 *)fbuf_buf(the_fbuf);
@@ -415,36 +440,52 @@ fdir_readdir (fbuf *the_fbuf,
if (npages < len / AFSDIR_PAGESIZE)
npages = len / AFSDIR_PAGESIZE;
- for (i = 0; i < npages; ++i) {
- DirPage1 *page = getpage (page0, i);
- unsigned first_slot;
+ if (offset && *offset) {
+ i = *offset / ENTRIESPERPAGE;
+ first_slot = *offset % ENTRIESPERPAGE;
+
+ assert(i > 0 || first_slot >= 12);
+ } else {
+ i = 0;
+ first_slot = 12;
+ }
- if (i == 0)
- first_slot = 12;
- else
- first_slot = 0;
+ for (; i < npages; ++i) {
+ DirPage1 *page = getpage (page0, i);
for (j = first_slot; j < ENTRIESPERPAGE - 1; ++j) {
- if (used_slot (page, j + 1)) {
+ if (first_slotp (page, j)) {
DirEntry *entry = &page->entry[j];
- assert (entry->flag);
+ if (entry->flag != AFSDIR_FIRST)
+ continue;
- fid.Cell = dir->Cell;
- fid.fid.Volume = dir->fid.Volume;
+ fid.Cell = dir.Cell;
+ fid.fid.Volume = dir.fid.Volume;
fid.fid.Vnode = ntohl (entry->fid.Vnode);
fid.fid.Unique = ntohl (entry->fid.Unique);
- (*func)(&fid, entry->name, arg);
-
+ ret = (*func)(&fid, entry->name, arg);
+ if (ret) {
+ if (ret > 0)
+ j++; /* look at next entry next time */
+
+ goto done;
+ }
j += additional_entries (entry->name);
}
}
+ first_slot = 0;
}
+ done:
+ if (offset)
+ *offset = i * ENTRIESPERPAGE + j;
+
return 0;
}
+#ifndef _KERNEL
/*
* Create a new directory with only . and ..
*/
@@ -518,7 +559,8 @@ fdir_creat (fbuf *dir,
assert (page0);
npages = ntohs(page0->header.pg_pgcount);
- assert (npages == dir->len / AFSDIR_PAGESIZE);
+ if (npages < fbuf_len(dir) / AFSDIR_PAGESIZE)
+ npages = fbuf_len(dir) / AFSDIR_PAGESIZE;
if (find_entry (page0, name))
return EEXIST;
@@ -573,6 +615,9 @@ fdir_remove (fbuf *dir,
page0 = (DirPage0 *)fbuf_buf(dir);
npages = ntohs(page0->header.pg_pgcount);
+ if (npages < len / AFSDIR_PAGESIZE)
+ npages = len / AFSDIR_PAGESIZE;
+
hash_value = hashentry (name);
i = ntohs(page0->dheader.hash[hash_value]);
found = i == 0;
@@ -618,3 +663,4 @@ fdir_remove (fbuf *dir,
return 0;
}
}
+#endif
diff --git a/usr.sbin/afs/src/lib/bufdir/fdir.h b/usr.sbin/afs/src/lib/bufdir/fdir.h
index 562f2c9a649..dbb68b99f63 100644
--- a/usr.sbin/afs/src/lib/bufdir/fdir.h
+++ b/usr.sbin/afs/src/lib/bufdir/fdir.h
@@ -35,12 +35,16 @@
* Interface to directory handling routines
*/
-/* $KTH: fdir.h,v 1.5 2000/10/02 22:59:49 lha Exp $ */
+/* $arla: fdir.h,v 1.7 2002/03/06 21:41:43 tol Exp $ */
#ifndef _FDIR_H_
#define _FDIR_H_
-#include <fs.h>
+#ifndef _KERNEL
+#include <roken.h>
+#endif
+
+#include <fids.h>
#include <fbuf.h>
int
@@ -58,13 +62,14 @@ fdir_changefid (fbuf *the_fbuf,
int
fdir_emptyp (fbuf *dir);
-typedef void (*fdir_readdir_func)(VenusFid *, const char *, void *);
+typedef int (*fdir_readdir_func)(VenusFid *, const char *, void *);
int
fdir_readdir (fbuf *the_fbuf,
fdir_readdir_func func,
void *arg,
- const VenusFid *dir);
+ VenusFid dir,
+ uint32_t *offset);
int
fdir_creat (fbuf *dir,
diff --git a/usr.sbin/afs/src/lib/editline/ChangeLog b/usr.sbin/afs/src/lib/editline/ChangeLog
index da507c8616c..8c8878736b6 100644
--- a/usr.sbin/afs/src/lib/editline/ChangeLog
+++ b/usr.sbin/afs/src/lib/editline/ChangeLog
@@ -1,7 +1,6 @@
-2001-10-23 Magnus Ahltorp <ahltorp@nada.kth.se>
+2001-05-26 Mattias Amnefelt <mattiasa@e.kth.se>
- * editline.c: 1.2->1.3: from heimdal/kth-krb: rename STATUS ->
- el_STATUS to avoid conflict with STATUS in arpa/nameser.h
+ * Makefile.in: use correct makefile syntax
2000-03-01 Assar Westerlund <assar@sics.se>
diff --git a/usr.sbin/afs/src/lib/editline/README b/usr.sbin/afs/src/lib/editline/README
index 73322ad276c..f5b0693a336 100644
--- a/usr.sbin/afs/src/lib/editline/README
+++ b/usr.sbin/afs/src/lib/editline/README
@@ -1,4 +1,4 @@
-$KTH: 1.2 $
+$arla: 1.2 $
This is a line-editing library. It can be linked into almost any
program to provide command-line editing and recall.
diff --git a/usr.sbin/afs/src/lib/editline/complete.c b/usr.sbin/afs/src/lib/editline/complete.c
index 0226b13c3d5..59d45ab241d 100644
--- a/usr.sbin/afs/src/lib/editline/complete.c
+++ b/usr.sbin/afs/src/lib/editline/complete.c
@@ -23,7 +23,7 @@
#include <config.h>
#include "editline.h"
-RCSID("$KTH: complete.c,v 1.2 2000/03/01 21:40:39 assar Exp $");
+RCSID("$arla: complete.c,v 1.2 2000/03/01 21:40:39 assar Exp $");
/*
** strcmp-like sorting predicate for qsort.
diff --git a/usr.sbin/afs/src/lib/editline/edit_compat.c b/usr.sbin/afs/src/lib/editline/edit_compat.c
index 2027e5a1652..6f4c37bf213 100644
--- a/usr.sbin/afs/src/lib/editline/edit_compat.c
+++ b/usr.sbin/afs/src/lib/editline/edit_compat.c
@@ -36,7 +36,7 @@
#include <string.h>
#include <histedit.h>
-RCSID("$KTH: edit_compat.c,v 1.3 2000/03/01 21:40:39 assar Exp $");
+RCSID("$arla: edit_compat.c,v 1.3 2000/03/01 21:40:39 assar Exp $");
void
rl_reset_terminal(char *p)
diff --git a/usr.sbin/afs/src/lib/editline/editline.3 b/usr.sbin/afs/src/lib/editline/editline.3
index 0ed555cd283..cdbf7a786c3 100644
--- a/usr.sbin/afs/src/lib/editline/editline.3
+++ b/usr.sbin/afs/src/lib/editline/editline.3
@@ -1,4 +1,4 @@
-.\" $KTH: 1.2 $
+.\" $arla: 1.2 $
.TH EDITLINE 3
.SH NAME
editline \- command-line editing library with history
diff --git a/usr.sbin/afs/src/lib/editline/editline.c b/usr.sbin/afs/src/lib/editline/editline.c
index 3c0184552e2..33f31dd7a11 100644
--- a/usr.sbin/afs/src/lib/editline/editline.c
+++ b/usr.sbin/afs/src/lib/editline/editline.c
@@ -25,7 +25,7 @@
#include <ctype.h>
#include <errno.h>
-RCSID("$KTH: editline.c,v 1.2.10.1 2001/10/23 17:59:45 ahltorp Exp $");
+RCSID("$arla: editline.c,v 1.3 2001/10/21 22:31:34 assar Exp $");
/*
** Manifest constants.
diff --git a/usr.sbin/afs/src/lib/editline/editline.h b/usr.sbin/afs/src/lib/editline/editline.h
index cd6c24e30e6..93c0fd4027d 100644
--- a/usr.sbin/afs/src/lib/editline/editline.h
+++ b/usr.sbin/afs/src/lib/editline/editline.h
@@ -1,4 +1,4 @@
-/* $KTH: 1.2 $
+/* $arla: 1.2 $
**
** Internal header file for editline library.
*/
diff --git a/usr.sbin/afs/src/lib/editline/sysunix.c b/usr.sbin/afs/src/lib/editline/sysunix.c
index 3dd64f09c68..6dd520f7239 100644
--- a/usr.sbin/afs/src/lib/editline/sysunix.c
+++ b/usr.sbin/afs/src/lib/editline/sysunix.c
@@ -29,7 +29,7 @@
#include <sgtty.h>
#endif
-RCSID("$KTH: sysunix.c,v 1.2 2000/03/01 21:40:41 assar Exp $");
+RCSID("$arla: sysunix.c,v 1.2 2000/03/01 21:40:41 assar Exp $");
#ifdef HAVE_TERMIOS_H
diff --git a/usr.sbin/afs/src/lib/editline/testit.c b/usr.sbin/afs/src/lib/editline/testit.c
index a122ff02597..eb7def06b6f 100644
--- a/usr.sbin/afs/src/lib/editline/testit.c
+++ b/usr.sbin/afs/src/lib/editline/testit.c
@@ -1,4 +1,4 @@
-/* $KTH: 1.2 $
+/* $arla: 1.2 $
**
** A "micro-shell" to test editline library.
** If given any arguments, commands aren't executed.
diff --git a/usr.sbin/afs/src/lib/editline/unix.h b/usr.sbin/afs/src/lib/editline/unix.h
index c2027aa6121..ece72cc9738 100644
--- a/usr.sbin/afs/src/lib/editline/unix.h
+++ b/usr.sbin/afs/src/lib/editline/unix.h
@@ -1,4 +1,4 @@
-/* $KTH: 1.2 $
+/* $arla: 1.2 $
**
** Editline system header file for Unix.
*/
diff --git a/usr.sbin/afs/src/lib/ko/afsconf.c b/usr.sbin/afs/src/lib/ko/afsconf.c
index e233a375f4c..d6e0aae6478 100644
--- a/usr.sbin/afs/src/lib/ko/afsconf.c
+++ b/usr.sbin/afs/src/lib/ko/afsconf.c
@@ -36,7 +36,7 @@
#include "ports.h"
#include <log.h>
-RCSID("$KTH: afsconf.c,v 1.5 2000/10/03 00:28:53 lha Exp $");
+RCSID("$arla: afsconf.c,v 1.5 2000/10/03 00:28:53 lha Exp $");
/*
* Currently only handles dir_path == NULL
diff --git a/usr.sbin/afs/src/lib/ko/agetarg.c b/usr.sbin/afs/src/lib/ko/agetarg.c
index 0f15bac8d1f..0e71ebe28c2 100644
--- a/usr.sbin/afs/src/lib/ko/agetarg.c
+++ b/usr.sbin/afs/src/lib/ko/agetarg.c
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: agetarg.c,v 1.8.2.3 2001/05/17 07:38:30 lha Exp $");
+RCSID("$arla: agetarg.c,v 1.13 2002/09/17 18:30:53 lha Exp $");
#endif
#include <stdio.h>
@@ -101,8 +101,8 @@ mandoc_template(struct agetargs *args,
t = time(NULL);
strftime(timestr, sizeof(timestr), "%b %d, %Y", localtime(&t));
printf(".Dd %s\n", timestr);
- p = strrchr(__progname, '/');
- if(p) p++; else p = __progname;
+ p = strrchr(getprogname(), '/');
+ if(p) p++; else p = getprogname();
strncpy(cmd, p, sizeof(cmd));
cmd[sizeof(cmd)-1] = '\0';
strupr(cmd);
@@ -176,7 +176,7 @@ aarg_printusage (struct agetargs *args,
size_t max_len = 0;
if (progname == NULL)
- progname = __progname;
+ progname = getprogname();
if(getenv("GETARGMANDOC")){
mandoc_template(args, extra_string, style);
@@ -428,6 +428,8 @@ arg_match_long(struct agetargs *args, int argc,
current = partial;
else
return AARG_ERR_NO_MATCH;
+
+ numarg = current - args;
}
if(*optarg == '\0' && !ISFLAG(current))
@@ -480,9 +482,8 @@ agetarg(struct agetargs *args,
usedargs[swcount] = 1;
i += j;
swcount++;
- } else if(argv[i][0] == '-' &&
- (argv[i][1] == '-' ||
- ((style & AARG_TRANSLONG) && argv[i][1] != 0))) {
+ } else if(argv[i][1] == '-' ||
+ ((style & AARG_TRANSLONG) && argv[i][1] != 0)) {
int k;
if(argv[i][2] == 0 && !(style & AARG_TRANSLONG)){
@@ -560,8 +561,7 @@ agetarg(struct agetargs *args,
}
}
out:;
- } else
- break;
+ }
}
*optind = i;
diff --git a/usr.sbin/afs/src/lib/ko/auth.c b/usr.sbin/afs/src/lib/ko/auth.c
index 30b73fd71f8..65ee3aaf39d 100644
--- a/usr.sbin/afs/src/lib/ko/auth.c
+++ b/usr.sbin/afs/src/lib/ko/auth.c
@@ -34,7 +34,7 @@
#include "ko_locl.h"
#include "auth.h"
-RCSID("$KTH: auth.c,v 1.5 2000/10/02 22:42:36 lha Exp $");
+RCSID("$arla: auth.c,v 1.7 2003/06/10 16:41:02 lha Exp $");
#ifdef KERBEROS
@@ -52,7 +52,7 @@ ktc_GetToken(const struct ktc_principal *server,
int token_len,
struct ktc_principal *client)
{
- u_int32_t i;
+ uint32_t i;
unsigned char t[128];
struct ViceIoctl parms;
@@ -109,6 +109,7 @@ ktc_SetToken(const struct ktc_principal *server,
const struct ktc_principal *client,
int unknown) /* XXX */
{
+#ifdef HAVE_KRB4
const char *cell;
CREDENTIALS cred;
int ret;
@@ -139,6 +140,20 @@ ktc_SetToken(const struct ktc_principal *server,
ret = kafs_settoken (cell, uid, &cred);
memset (&cred, 0, sizeof(cred));
return ret;
+#elif defined(HAVE_KAFS_SETTOKEN_RXKAD)
+ struct ClearToken ct;
+ int ret;
+
+ ct.AuthHandle = token.kvno;
+ memcpy(&ct.HandShakeKey, &token.sessionKey, sizeof(ct.HandShakeKey));
+ ct.BeginTimestamp = token.startTime;
+ ct.EndTimestamp = token.endTime;
+
+ ret = kafs_settoken_rxkad (server->cell, &ct,
+ token.ticket, token.ticketLen);
+ memset(&ct, 0, sizeof(ct));
+ return ret;
+#endif
}
#endif /* KERBEROS */
diff --git a/usr.sbin/afs/src/lib/ko/auth.h b/usr.sbin/afs/src/lib/ko/auth.h
index 2fb443813d3..6b96ba6ff9e 100644
--- a/usr.sbin/afs/src/lib/ko/auth.h
+++ b/usr.sbin/afs/src/lib/ko/auth.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: auth.h,v 1.3 2000/10/02 22:42:41 lha Exp $ */
+/* $arla: auth.h,v 1.4 2003/06/10 14:46:27 lha Exp $ */
#ifndef __AUTH_H
#define __AUTH_H 1
@@ -42,7 +42,9 @@
#include <netinet/in.h>
#include <atypes.h>
#include <rx/rx.h>
+#ifdef HAVE_KRB4
#include <krb.h>
+#endif
#include <kafs.h>
#include <rxkad.h>
diff --git a/usr.sbin/afs/src/lib/ko/cellconfig.h b/usr.sbin/afs/src/lib/ko/cellconfig.h
index 0a50a65f873..ada3bf22b7d 100644
--- a/usr.sbin/afs/src/lib/ko/cellconfig.h
+++ b/usr.sbin/afs/src/lib/ko/cellconfig.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: cellconfig.h,v 1.2 2000/10/02 22:42:46 lha Exp $ */
+/* $arla: cellconfig.h,v 1.2 2000/10/02 22:42:46 lha Exp $ */
#ifndef __CELLCONFIG_H
#define __CELLCONFIG_H 1
diff --git a/usr.sbin/afs/src/lib/ko/gensysname.c b/usr.sbin/afs/src/lib/ko/gensysname.c
index 676c9dac2fc..45c34962c47 100644
--- a/usr.sbin/afs/src/lib/ko/gensysname.c
+++ b/usr.sbin/afs/src/lib/ko/gensysname.c
@@ -33,8 +33,9 @@
#include "ko_locl.h"
#include <fnmatch.h>
+#include <getarg.h>
-RCSID("$KTH: gensysname.c,v 1.35.2.1 2001/09/15 13:33:04 mattiasa Exp $");
+RCSID("$arla: gensysname.c,v 1.39 2003/04/09 02:39:31 lha Exp $");
typedef int (*test_sysname)(void);
typedef void (*gen_sysname)(char*, size_t, const char*,
@@ -75,7 +76,6 @@ osf_gen_sysname(char *buf,
const char *vendor,
const char *os)
{
-
int minor, major, nargs;
char patch;
nargs = sscanf(os, "osf%d.%d%c", &major, &minor, &patch);
@@ -86,7 +86,6 @@ osf_gen_sysname(char *buf,
} else {
snprintf(buf, len, "alpha_osf");
}
-
}
@@ -154,6 +153,7 @@ struct sysname sysnames[] = {
{ "sun4x_55", "sparc*", "*", "solaris2.5*", NULL },
{ "sun4x_56", "sparc*", "*", "solaris2.6*", NULL },
{ "sun4x_57", "sparc*", "*", "solaris2.7*", NULL },
+ { "sun4x_58", "sparc*", "*", "solaris2.8*", NULL },
{ "sunx86_54", "i386", "*", "solaris2.4*", NULL },
{ "sunx86_551", "i386", "*", "solaris2.5.1*", NULL },
{ "sunx86_55", "i386", "*", "solaris2.5*", NULL },
@@ -180,7 +180,7 @@ printsysname(const char *sysname)
printf("%s\n", sysname);
break;
case OUTPUT_C:
- printf("/* Generated from $KTH: gensysname.c,v 1.35.2.1 2001/09/15 13:33:04 mattiasa Exp $ */\n\n");
+ printf("/* Generated from $arla: gensysname.c,v 1.39 2003/04/09 02:39:31 lha Exp $ */\n\n");
printf("#ifdef HAVE_CONFIG_H\n#include <config.h>\n#endif\n");
printf("#include <ko.h>\n\n");
printf("const char *arla_getsysname(void) { return \"%s\" ; }\n",
@@ -200,21 +200,20 @@ static int allflag = 0;
static int sysnameflag = 0;
static int versionflag = 0;
-struct agetargs args[] = {
- {"machine", 'm', aarg_flag, &machineflag, "machine output", NULL},
- {"human", 'h', aarg_flag, &humanflag, "human", NULL},
- {"ccode", 'c', aarg_flag, &ccodeflag, "", NULL},
- {"sysname", 's', aarg_flag, &sysnameflag, NULL, NULL},
- {"version", 'v', aarg_flag, &versionflag, NULL, NULL},
- {"all", 'a', aarg_flag, &allflag, NULL, NULL},
- {"help", 0, aarg_flag, &helpflag, NULL, NULL},
- {NULL, 0, aarg_end, NULL}
+struct getargs args[] = {
+ {"machine", 'm', arg_flag, &machineflag, "machine output", NULL},
+ {"human", 'h', arg_flag, &humanflag, "human", NULL},
+ {"ccode", 'c', arg_flag, &ccodeflag, "", NULL},
+ {"sysname", 's', arg_flag, &sysnameflag, NULL, NULL},
+ {"version", 'v', arg_flag, &versionflag, NULL, NULL},
+ {"all", 'a', arg_flag, &allflag, NULL, NULL},
+ {"help", 0, arg_flag, &helpflag, NULL, NULL},
};
static void
usage(void)
{
- aarg_printusage(args, NULL, "[sysname]", 0);
+ arg_printusage(args, NULL, "[sysname]", 0);
exit(1);
}
@@ -249,7 +248,7 @@ main(int argc, char **argv)
int found = 0;
int optind = 0;
- if (agetarg (args, argc, argv, &optind, AARG_GNUSTYLE))
+ if (getarg (args, sizeof(args)/sizeof(args[0]), argc, argv, &optind))
usage();
argc -= optind;
@@ -259,7 +258,7 @@ main(int argc, char **argv)
usage();
if (versionflag)
- errx(0, "Version: $KTH: gensysname.c,v 1.35.2.1 2001/09/15 13:33:04 mattiasa Exp $");
+ errx(0, "Version: $arla: gensysname.c,v 1.39 2003/04/09 02:39:31 lha Exp $");
if (ccodeflag)
output = OUTPUT_C;
diff --git a/usr.sbin/afs/src/lib/ko/ko.h b/usr.sbin/afs/src/lib/ko/ko.h
index 27bc80bcbd1..ee84bcbde1c 100644
--- a/usr.sbin/afs/src/lib/ko/ko.h
+++ b/usr.sbin/afs/src/lib/ko/ko.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: ko.h,v 1.27.2.2 2001/05/06 22:40:49 ahltorp Exp $ */
+/* $arla: ko.h,v 1.36 2002/12/06 05:00:04 lha Exp $ */
#ifndef __KO_H
#define __KO_H 1
@@ -71,6 +71,12 @@ enum { SUID_CELL = 0x1, /* if this is a suid cell */
DYNROOT_CELL = 0x2 /* cell should show up in dynroot */
};
+enum { DYNROOT_CELLID = 0 };
+
+enum {
+ DYNROOT_ALIAS_READONLY = 0,
+ DYNROOT_ALIAS_READWRITE = 1
+};
typedef struct {
int32_t id; /* Cell-ID */
@@ -81,9 +87,10 @@ typedef struct {
cell_db_entry *dbservers; /* Database servers */
unsigned flags; /* Various flags, like SUID_CELL */
time_t timeout; /* when this entry expire */
+ time_t poller_timeout; /* delta time between poller calls */
} cell_entry;
-void cell_init (int cellcachesize, Log_method *log);
+void cell_init (int cellcachesize, Log_method *logm);
const cell_db_entry *cell_dbservers_by_id (int32_t cell, int *);
@@ -104,11 +111,17 @@ Bool cell_setsuid_by_num (int32_t cell);
int cell_setthiscell (const char *cell);
int cell_foreach (int (*func) (const cell_entry *, void *),
void *arg);
+typedef int (*cell_alias_fn)(const char *, const char *, int, void *);
+int cell_alias_foreach (cell_alias_fn, void *);
+int cell_addalias(const char *, const char *, const char *);
const char *cell_expand_cell (const char *cell);
unsigned long cell_get_version(void);
Bool cell_is_sanep (int cell);
const char ** cell_thesecells (void);
-void cell_print_cell (cell_entry *c, FILE *out);
+void cell_print_cell (const cell_entry *c, FILE *out);
+void cell_status (FILE *f);
+time_t cell_get_poller_time(const cell_entry *c);
+void cell_set_poller_time(cell_entry *c, time_t time);
/*
@@ -126,4 +139,15 @@ size_t volname_specific (const char *volname, int type,
char *buf, size_t buf_sz);
const char *volname_suffix (int type);
+char *vol_getopname(int32_t op, char *str, size_t sz);
+const char *volumetype_from_serverflag(int32_t flag);
+const char *volumetype_from_volsertype(int32_t type);
+
+/*
+ * misc
+ */
+
+int
+VenusFid_cmp (const VenusFid *fid1, const VenusFid *fid2);
+
#endif /* __KO_H */
diff --git a/usr.sbin/afs/src/lib/ko/ko_locl.h b/usr.sbin/afs/src/lib/ko/ko_locl.h
index d6362f56bfa..47305ceb667 100644
--- a/usr.sbin/afs/src/lib/ko/ko_locl.h
+++ b/usr.sbin/afs/src/lib/ko/ko_locl.h
@@ -32,10 +32,13 @@
*/
/*
- * Include file for whole arlad
- * $KTH: ko_locl.h,v 1.12 2000/10/02 22:43:03 lha Exp $
+ * Private Include file for libko
+ * $arla: ko_locl.h,v 1.14 2002/07/24 07:03:42 lha Exp $
*/
+#ifndef _LIBKO_H
+#define _LIBKO_H 1
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -68,6 +71,7 @@
#include <netdb.h>
#include <fcntl.h>
#include <err.h>
+#include <limits.h>
#include <strings.h>
#include <roken.h>
#include <parse_units.h>
@@ -75,8 +79,16 @@
#include <hash.h>
#include <bool.h>
+#include <list.h>
#include <log.h>
#include "ko.h"
+/* resolver independant api for libko */
+enum { CELL_INVALID_HOST = 1 };
+
+void _ko_resolve_init(void);
+int _ko_resolve_cell(const char *, cell_db_entry *, int, int *, int *);
+int _ko_resolve_host(const char *, cell_db_entry *);
+#endif /* _LIBKO_H */
diff --git a/usr.sbin/afs/src/lib/ko/kocell.c b/usr.sbin/afs/src/lib/ko/kocell.c
index b699d720df4..cd2403e6948 100644
--- a/usr.sbin/afs/src/lib/ko/kocell.c
+++ b/usr.sbin/afs/src/lib/ko/kocell.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -37,20 +37,11 @@
#include "ko_locl.h"
-#ifdef HAVE_ARPA_NAMESER_H
-#include <arpa/nameser.h>
-#endif
-#ifdef HAVE_RESOLV_H
-#include <resolv.h>
-#endif
-
-#ifdef KERBEROS
+#ifdef HAVE_KRB4
#include <krb.h>
#endif
-#include "resolve.h"
-
-RCSID("$KTH: kocell.c,v 1.47.2.3 2001/07/09 03:27:48 lha Exp $");
+RCSID("$arla: kocell.c,v 1.75 2003/06/10 16:52:06 lha Exp $");
#define TRANSARCSYSCONFDIR "/usr/vice/etc"
#define CELLFILENAME "CellServDB"
@@ -58,6 +49,7 @@ RCSID("$KTH: kocell.c,v 1.47.2.3 2001/07/09 03:27:48 lha Exp $");
#define SUIDCELLSFILENAME "SuidCells"
#define THESECELLFILENAME "TheseCells"
#define DYNROOTDBFILENAME "DynRootDB"
+#define ALIASDBFILENAME "AliasDB"
#define DEFCELLCACHESIZE 499
/*
@@ -75,8 +67,6 @@ static char **thesecells = NULL;
static int numthesecells = 1;
static int dynrootdb_in_use;
-enum { CELL_INVALID_HOST = 1 };
-
/*
* Logging
*/
@@ -110,6 +100,19 @@ static unsigned long celldb_version = 0;
static int add_special_dynroot_cell (void);
/*
+ * Cell alias
+ */
+
+struct cellalias {
+ char *name;
+ char *alias;
+ int type;
+ Listitem *li;
+};
+
+static List *cellaliaslist;
+
+/*
* Functions for handling cell entries.
*/
@@ -175,36 +178,27 @@ newcell (char *line)
}
/*
- *
+ * Verify that that host is valid (dns wise)
*/
static void
fetch_host (cell_entry *c, cell_db_entry *host)
{
- struct dns_reply *r;
- struct resource_record *rr;
struct timeval tv;
+ int ret;
gettimeofday (&tv, NULL);
- r = dns_lookup(host->name, "A");
- if (r == NULL) {
+ ret = _ko_resolve_host(host->name, host);
+ if (ret) {
log_log (cell_log, CDEBDNS,
"fetch_host: failed to resolve host %s in cell %s",
host->name, c->name);
host->timeout = CELL_INVALID_HOST;
return;
}
- for(rr = r->head; rr;rr=rr->next){
- if (rr->type == T_A) {
- if (strcmp(host->name,rr->domain) == 0) {
- host->addr = *(rr->u.a);
- host->timeout = tv.tv_sec + rr->ttl;
- break;
- }
- }
- }
- dns_free_data(r);
+
+ host->timeout += tv.tv_sec;
}
@@ -244,12 +238,17 @@ updatehosts (cell_entry *c, int dbnum, cell_db_entry *dbservers)
}
}
- c->ndbservers = dbnum;
- c->dbservers = malloc (dbnum * sizeof(cell_db_entry));
- if (c->dbservers == NULL && dbnum != 0)
- err (1, "malloc %lu", (unsigned long)dbnum * sizeof(cell_db_entry));
- memcpy (c->dbservers, dbservers, dbnum * sizeof (cell_db_entry));
- free (old_servers);
+ if (c->dbservers != dbservers) {
+ c->ndbservers = dbnum;
+ c->dbservers = malloc (dbnum * sizeof(cell_db_entry));
+ if (c->dbservers == NULL && dbnum != 0)
+ err (1, "malloc %lu",
+ (unsigned long)dbnum * sizeof(cell_db_entry));
+ memcpy (c->dbservers, dbservers, dbnum * sizeof (cell_db_entry));
+ free (old_servers);
+ } else {
+ assert(c->ndbservers == dbnum);
+ }
if (c->ndbservers)
qsort (c->dbservers, c->ndbservers, sizeof(c->dbservers[0]),
@@ -270,63 +269,34 @@ updatehosts (cell_entry *c, int dbnum, cell_db_entry *dbservers)
static int
dns_lookup_cell (const char *cell, cell_entry *c)
{
- struct dns_reply *r;
- struct resource_record *rr;
- int dbnum = 0;
+ int i, ret, dbnum = 0;
cell_db_entry dbservers[256];
int lowest_ttl = INT_MAX;
- int i;
struct timeval tv;
memset (dbservers, 0, sizeof(dbservers));
gettimeofday(&tv, NULL);
- r = dns_lookup(cell, "AFSDB");
- if (r == NULL) {
+ ret = _ko_resolve_cell(cell, dbservers,
+ sizeof(dbservers)/sizeof(dbservers[0]),
+ &dbnum, &lowest_ttl);
+ if (ret) {
log_log (cell_log, CDEBDNS,
"dns_lookup_cell: failed to resolve cell %s", cell);
- return 1;
+ return ret;
}
- if (c == NULL)
- c = cell_new_dynamic (cell);
- for(rr = r->head; rr;rr=rr->next){
- if(rr->type == T_AFSDB) {
- struct mx_record *mx = (struct mx_record*)rr->u.data;
-
- if (mx->preference != 1) {
- break;
- }
- if (dbnum >= sizeof (dbservers) / sizeof(*dbservers)) {
- break;
- }
- if (lowest_ttl > rr->ttl)
- lowest_ttl = rr->ttl;
- dbservers[dbnum].name = strdup (mx->domain);
- if (dbservers[dbnum].name == NULL)
- err (1, "strdup");
- dbservers[dbnum].timeout = CELL_INVALID_HOST;
- dbnum++;
- }
- }
- for(rr = r->head; rr;rr=rr->next){
- if (rr->type == T_A) {
- for (i = 0; i < dbnum; i++) {
- if (strcmp(dbservers[i].name,rr->domain) == 0) {
- dbservers[i].addr = *(rr->u.a);
- dbservers[i].timeout = tv.tv_sec + rr->ttl;
- break;
- }
- }
- }
- }
- dns_free_data(r);
+ for (i = 0; i < dbnum; i++)
+ if (dbservers[i].timeout != CELL_INVALID_HOST)
+ dbservers[i].timeout += tv.tv_sec;
if (lowest_ttl == INT_MAX)
- lowest_ttl = 0;
-
- /* catch the hosts that didn't fit in additional rr */
+ lowest_ttl = 5 * 60;
+
+ if (c == NULL)
+ c = cell_new_dynamic (cell);
c->timeout = lowest_ttl + tv.tv_sec;
+ /* catch the hosts that didn't fit in additional rr */
updatehosts (c, dbnum, dbservers);
return 0;
}
@@ -343,6 +313,9 @@ update_cell (cell_entry *c)
gettimeofday(&tv, NULL);
+ if (c->id == DYNROOT_CELLID)
+ return;
+
if ((c->timeout && c->timeout < tv.tv_sec)
|| c->ndbservers == 0) {
dns_lookup_cell (c->name, c);
@@ -410,8 +383,8 @@ cell_new (const char *name)
free (c);
return NULL;
}
- assert (cellno != 0);
c->id = cellno++;
+ assert(c->id != DYNROOT_CELLID);
c->expl = NULL;
c->ndbservers = 0;
c->active_hosts = 0;
@@ -420,6 +393,7 @@ cell_new (const char *name)
hashtabadd (cellnamehtab, c);
hashtabadd (cellnumhtab, c);
c->timeout = 0;
+ c->poller_timeout = 0;
celldb_version++;
return c;
}
@@ -432,21 +406,11 @@ cell_entry *
cell_new_dynamic (const char *name)
{
cell_entry *c;
- FILE *f;
c = cell_new (name);
if (c == NULL)
return NULL;
c->expl = "dynamically added cell";
- f = fopen (SYSCONFDIR "/" CELLFILENAME, "a");
- if (f == NULL)
- f = fopen (TRANSARCSYSCONFDIR "/" CELLFILENAME, "a");
- if (f == NULL) {
- log_log (cell_log, CDEBWARN,"Cannot open CellServDB for writing");
- return c;
- }
- fprintf (f, ">%s #dynamically added cell\n", name);
- fclose (f);
return c;
}
@@ -522,7 +486,7 @@ readcellservdb (const char *filename)
while (fgets (line, sizeof (line), f)) {
++lineno;
i = 0;
- line[strlen(line) - 1] = '\0';
+ line[strcspn(line, "\n")] = '\0';
while (line[0] && isspace((unsigned char)line[i]))
i++;
if (line[i] == '#' || line[i] == '\0')
@@ -552,7 +516,7 @@ readcellservdb (const char *filename)
*/
static int
-parse_simple_file (const char *filename, void (*func)(const char *))
+parse_simple_file (const char *filename, void (*func)(char *))
{
FILE *f;
char line[256];
@@ -562,7 +526,7 @@ parse_simple_file (const char *filename, void (*func)(const char *))
return 1;
while ((fgets (line, sizeof(line), f) != NULL)) {
- line[strlen(line) - 1] = '\0';
+ line[strcspn(line, "\n")] = '\0';
(*func) (line);
}
fclose (f);
@@ -574,16 +538,25 @@ parse_simple_file (const char *filename, void (*func)(const char *))
*/
static void
-addthesecell (const char *cellname)
+addthesecell (char *cellname)
{
+ const char *cell;
+ char **ntc;
int i;
- cellname = cell_expand_cell (cellname);
+
+ cell = cell_expand_cell (cellname);
for (i = 0; thesecells && thesecells[i]; i++)
- if (strcasecmp (thesecells[i], cellname) == 0)
+ if (strcasecmp (thesecells[i], cell) == 0)
return;
- thesecells = erealloc (thesecells,
- (numthesecells + 1) * sizeof (char *));
- thesecells[numthesecells - 1] = estrdup (cellname);
+
+ ntc = realloc (thesecells, (numthesecells + 1) * sizeof (char *));
+ if (ntc == NULL)
+ errx(1, "realloc");
+ thesecells = ntc;
+
+ thesecells[numthesecells - 1] = strdup (cell);
+ if (thesecells[numthesecells - 1] == NULL)
+ errx(1, "strdup");
thesecells[numthesecells] = NULL;
++numthesecells;
}
@@ -616,12 +589,11 @@ readthiscell (const char *filename)
return 1;
if (fgets (cell, sizeof cell, f) == NULL) {
- log_log (cell_log, CDEBERR, "Cannot read cellname from %s\n",
+ log_log (cell_log, CDEBERR, "Cannot read cellname from %s",
filename);
return 1;
}
- if (cell[strlen(cell) - 1] == '\n')
- cell[strlen(cell) - 1] = '\0';
+ cell[strcspn(cell, "\n")] = '\0';
thiscell = strdup (cell);
if (thiscell == NULL)
err (1, "strdup");
@@ -634,14 +606,14 @@ readthiscell (const char *filename)
*/
static void
-addsuidcell (const char *cellname)
+addsuidcell (char *cellname)
{
cell_entry *e;
e = cell_get_by_name (cellname);
if (e == NULL) {
log_log (cell_log, CDEBWARN,
- "suidcell: cell %s doesn't exist in the db\n", cellname);
+ "suidcell: cell %s doesn't exist in the db", cellname);
} else {
e->flags |= SUID_CELL;
}
@@ -658,14 +630,14 @@ readsuidcell (const char *filename)
*/
static void
-add_dynroot(const char *cellname)
+add_dynroot(char *cellname)
{
cell_entry *e;
e = cell_get_by_name (cellname);
if (e == NULL) {
log_log (cell_log, CDEBWARN,
- "dynroot: cell %s doesn't exist in the db\n", cellname);
+ "dynroot: cell %s doesn't exist in the db", cellname);
} else {
e->flags |= DYNROOT_CELL;
dynrootdb_in_use = 1;
@@ -678,6 +650,58 @@ readdynrootdb (const char *filename)
return parse_simple_file (filename, add_dynroot);
}
+static void
+add_alias(char *alias_line)
+{
+ const char *delim = " \t";
+ char *cellname, *aliasname, *type, *al;
+ size_t sz;
+
+ al = alias_line;
+
+#define ENDSTR(str) ((str) == NULL || *(str) == '\0' || *(str) == '#')
+
+ sz = strspn(alias_line, delim);
+ al = al + sz;
+ if (ENDSTR(al))
+ return;
+ cellname = strsep(&al, delim);
+ if (ENDSTR(cellname) || al == NULL)
+ goto out;
+ sz = strspn(al, delim);
+ al = al + sz;
+ if (ENDSTR(al))
+ goto out;
+ aliasname = strsep(&al, delim);
+ if (ENDSTR(aliasname))
+ goto out;
+
+ type = "readonly";
+ if (al != NULL) {
+ sz = strspn(al, delim);
+ al = al + sz;
+ if (!ENDSTR(al)) {
+ al = strsep(&al, delim);
+ if (!ENDSTR(al))
+ type = al;
+ }
+ }
+
+#undef ENDSTR
+ cell_addalias(cellname, aliasname, type);
+ return;
+
+ out:
+ log_log (cell_log, CDEBWARN,
+ "alias: failed to parse line `%s'", alias_line);
+}
+
+static int
+readaliasdb (const char *filename)
+{
+ return parse_simple_file (filename, add_alias);
+}
+
/*
* Initialize the cache of cell information.
*/
@@ -685,12 +709,13 @@ readdynrootdb (const char *filename)
static int cell_inited = 0;
void
-cell_init (int cellcachesize, Log_method *log)
+cell_init (int cellcachesize, Log_method *logm)
{
- char *env;
+ char *env = NULL;
+ uid_t uid,euid;
int ret;
- assert (log);
+ assert (logm);
if (cell_inited) {
log_log (cell_log, CDEBWARN, "cell_init: Already initlized");
@@ -698,11 +723,9 @@ cell_init (int cellcachesize, Log_method *log)
}
cell_inited = 1;
-#ifdef HAVE_RES_INIT
- res_init();
-#endif
+ _ko_resolve_init();
- cell_log = log_unit_init (log, "cell", celldebug_units, CDEBDEFAULT);
+ cell_log = log_unit_init (logm, "cell", celldebug_units, CDEBDEFAULT);
if (cell_log == NULL)
errx (1, "cell_init: log_unit_init failed");
@@ -716,9 +739,16 @@ cell_init (int cellcachesize, Log_method *log)
if (cellnumhtab == NULL)
errx (1, "cell_init: hashtabnew failed");
- env = getenv ("AFSCELL");
+ uid = getuid();
+ euid = geteuid();
+
+ if(uid == euid)
+ env = getenv ("AFSCELL");
+
if (env != NULL) {
- thiscell = estrdup (env);
+ thiscell = strdup (env);
+ if (thiscell == NULL)
+ errx(1, "strdup");
} else if (readthiscell (SYSCONFDIR "/" THISCELLFILENAME)) {
if (readthiscell(TRANSARCSYSCONFDIR "/" THISCELLFILENAME))
errx (1, "could not open "
@@ -727,7 +757,18 @@ cell_init (int cellcachesize, Log_method *log)
TRANSARCSYSCONFDIR "/" THISCELLFILENAME);
}
- if (readcellservdb (SYSCONFDIR "/" CELLFILENAME)) {
+ env = NULL;
+
+ if(uid == euid)
+ env = getenv("CELLSERVDBFILE");
+
+ if(env != NULL) {
+ if(readcellservdb (env)) {
+ log_log (cell_log, CDEBWARN,
+ "Can't read the CellServDB file, "
+ "will use DNS AFSDB entries");
+ }
+ } else if (readcellservdb (SYSCONFDIR "/" CELLFILENAME)) {
if (readcellservdb(TRANSARCSYSCONFDIR "/" CELLFILENAME)) {
log_log (cell_log, CDEBWARN,
"Can't read the CellServDB file, "
@@ -753,6 +794,9 @@ cell_init (int cellcachesize, Log_method *log)
if (readdynrootdb (SYSCONFDIR "/" DYNROOTDBFILENAME))
readdynrootdb (TRANSARCSYSCONFDIR "/" DYNROOTDBFILENAME);
+ cellaliaslist = listnew();
+ if (readaliasdb (SYSCONFDIR "/" ALIASDBFILENAME))
+ readaliasdb (TRANSARCSYSCONFDIR "/" ALIASDBFILENAME);
}
/*
@@ -817,7 +861,7 @@ cell_getcellbyhost(const char *host)
const char *ptr = NULL;
assert(host);
-#ifdef KERBEROS
+#ifdef HAVE_KRB4
ptr = krb_realmofhost(host);
#endif
if (ptr)
@@ -867,8 +911,8 @@ cell_num2name (int32_t cell)
const char *
cell_getthiscell (void)
{
- assert (thiscell != NULL);
-
+ if (thiscell == NULL)
+ return "unknown-cell-missing-configuration";
return thiscell;
}
@@ -962,10 +1006,10 @@ cell_setsuid_by_num (int32_t cell)
*/
void
-cell_print_cell (cell_entry *c, FILE *out)
+cell_print_cell (const cell_entry *c, FILE *out)
{
int i;
- char timestr[30];
+ char timestr[128];
struct tm tm;
time_t t;
@@ -974,9 +1018,9 @@ cell_print_cell (cell_entry *c, FILE *out)
fprintf (out, "comment: %s\n", c->expl);
if (c->timeout) {
t = c->timeout;
- strftime(timestr, sizeof(timestr),
- "%Y-%m-%d %H:%M:%S", localtime_r(&t, &tm));
- fprintf (out, "timeout: %s\n", timestr);
+ if (strftime(timestr, sizeof(timestr),
+ "%Y-%m-%d %H:%M:%S", localtime_r(&t, &tm)) > 0)
+ fprintf (out, "timeout: %s\n", timestr);
}
fprintf (out, "num hosts: %d active hosts: %d\n",
c->ndbservers, c->active_hosts);
@@ -988,15 +1032,36 @@ cell_print_cell (cell_entry *c, FILE *out)
buf = "no timeout";
else {
t = c->timeout;
- strftime(timestr, sizeof(timestr),
- "%Y-%m-%d %H:%M:%S", localtime_r(&t, &tm));
- buf = timestr;
+ if (strftime(timestr, sizeof(timestr),
+ "%Y-%m-%d %H:%M:%S", localtime_r(&t, &tm)) > 0)
+ buf = timestr;
+ else
+ buf = "time-error";
}
fprintf (out, " host: %s %s - %s\n", c->dbservers[i].name,
inet_ntoa (c->dbservers[i].addr), buf);
}
}
+static int
+cell_info_print (const cell_entry *e, void *ptr)
+{
+ FILE *f = (FILE *)ptr;
+ cell_print_cell(e, f);
+ return 0;
+}
+
+/*
+ * Print all cell info on `f'
+ */
+
+void
+cell_status (FILE *f)
+{
+ cell_foreach(cell_info_print, f);
+}
+
+
/*
* Iterate over all entries in the cell-db with `func'
* (that takes the cellname and `arg' as arguments)
@@ -1015,6 +1080,9 @@ cell_iterate_func (void *ptr, void *arg)
cell_entry *cell = (cell_entry *) ptr;
int ret;
+ if (cell->id == DYNROOT_CELLID)
+ return 0;
+
ret = (cia->func) (cell, cia->arg);
if (ret)
cia->ret = ret;
@@ -1105,7 +1173,7 @@ add_special_dynroot_cell (void)
free (c);
return errno;
}
- c->id = 0; /* XXX */
+ c->id = DYNROOT_CELLID;
c->expl = "The special dynroot cell";
c->ndbservers = 0;
c->dbservers = NULL;
@@ -1124,3 +1192,121 @@ cell_is_sanep (int cell)
{
return cell < cellno;
}
+
+/*
+ * Get the poller delta time for `cell'. Default is zero, that means
+ * that the caller should use the default poller timeout.
+ */
+
+time_t
+cell_get_poller_time(const cell_entry *cell)
+{
+ return cell->poller_timeout;
+}
+
+/*
+ * Set the poller delta `time' for `cell'.
+ */
+
+void
+cell_set_poller_time(cell_entry *cell, time_t time)
+{
+ cell->poller_timeout = time;
+}
+
+/*
+ *
+ */
+
+static int
+find_alias (const char *cellname, const char *alias, int type, void *arg)
+{
+ const char *newcell = arg;
+ if (strcmp(alias, newcell) == 0)
+ return EEXIST;
+ return 0;
+}
+
+int
+cell_addalias(const char *cellname, const char *alias, const char *stype)
+{
+ struct cellalias *ca;
+ int type;
+ int ret;
+
+ if (strcasecmp("readonly", stype) == 0 ||
+ strcasecmp("ro", stype) == 0)
+ type = DYNROOT_ALIAS_READONLY;
+ else if (strcasecmp("readwrite", stype) == 0 ||
+ strcasecmp("rw", stype) == 0)
+ type = DYNROOT_ALIAS_READWRITE;
+ else
+ return EINVAL;
+
+ ret = cell_alias_foreach(find_alias, (void *)alias);
+ if (ret)
+ return ret;
+
+ ca = malloc(sizeof(*ca));
+ if (ca == NULL)
+ return ENOMEM;
+ memset(ca, 0, sizeof(*ca));
+
+ ca->type = type;
+ ca->name = strdup(cellname);
+ if (ca->name == NULL)
+ goto out;
+ ca->alias = strdup(alias);
+ if (ca->alias == NULL)
+ goto out;
+ ca->li = listaddtail(cellaliaslist, ca);
+ if (ca->li == NULL)
+ goto out;
+
+ celldb_version++;
+
+ return 0;
+ out:
+ if (ca->name)
+ free(ca->name);
+ if (ca->alias)
+ free(ca->alias);
+ free(ca);
+ return ENOMEM;
+}
+
+
+/*
+ *
+ */
+
+struct listalias_ctx {
+ cell_alias_fn func;
+ void *ptr;
+ int error;
+};
+
+static Bool
+listalias_f(List *list, Listitem *li, void *arg)
+{
+ struct cellalias *ca = listdata(li);
+ struct listalias_ctx *ctx = arg;
+
+ ctx->error = (*ctx->func)(ca->name, ca->alias, ca->type, ctx->ptr);
+ if (ctx->error)
+ return TRUE;
+ return FALSE;
+}
+
+int
+cell_alias_foreach (cell_alias_fn func, void *ptr)
+{
+ struct listalias_ctx c;
+ c.func = func;
+ c.ptr = ptr;
+ c.error = 0;
+
+ listiter(cellaliaslist, listalias_f, &c);
+
+ return c.error;
+}
diff --git a/usr.sbin/afs/src/lib/ko/koerror.c b/usr.sbin/afs/src/lib/ko/koerror.c
index 7397f089a26..90e099417c4 100644
--- a/usr.sbin/afs/src/lib/ko/koerror.c
+++ b/usr.sbin/afs/src/lib/ko/koerror.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1998 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: koerror.c,v 1.20 2001/01/08 16:48:03 lha Exp $");
+RCSID("$arla: koerror.c,v 1.27 2003/06/10 16:52:51 lha Exp $");
#endif
#include <stdio.h>
@@ -41,22 +41,27 @@ RCSID("$KTH: koerror.c,v 1.20 2001/01/08 16:48:03 lha Exp $");
#include <roken.h>
-#include <vldb.h>
-#include <volumeserver.h>
-#include <pts.h>
-#include <bos.h>
-#include <ubik.h>
#include <rx/rx.h>
#include <rx/rxgencon.h>
-#ifdef KERBEROS
+#ifdef HAVE_KRB4
#include <krb.h>
+#ifdef HAVE_OPENSSL
+#include <openssl/des.h>
+#else
#include <des.h>
-#include <rxkad.h>
#endif
-#include <ka.h>
+#endif /* HAVE_KRB4 */
+#include <rxkad.h>
#include <ko.h>
#include <fs_errors.h>
+#include <vldb.h>
+#include <volumeserver.h>
+#include <pts.h>
+#include <bos.h>
+#include <ubik.h>
+#include <ka.h>
+
struct koerr {
koerr_t code;
const char *msg;
@@ -94,6 +99,10 @@ static struct koerr koerrmsg[] = {
{VL_BADSERVERFLAG, "VL - Invalid replication site server flag."},
{VL_PERM, "VL - No permission access."},
{VL_NOMEM, "VL - malloc(realloc) failed to alloc enough memory"},
+ {VL_BADVERSION, "VL - Bad version"},
+ {VL_INDEXERANGE, "VL - Index out of range"},
+ {VL_MULTIPADDR, "VL - Multiple IP addresses"},
+ {VL_BADMASK, "VL - Bad mask"},
/* VOLSER errors */
@@ -150,7 +159,7 @@ static struct koerr koerrmsg[] = {
{RXKADINCONSISTENCY, "rxkad - Inconsistency."},
{RXKADPACKETSHORT, "rxkad - Packet too short."},
{RXKADLEVELFAIL, "rxkad - Security level failed."},
- {RXKADTICKETLEN, "rxkad - Invaild ticket length."},
+ {RXKADTICKETLEN, "rxkad - Invalid ticket length."},
{RXKADOUTOFSEQUENCE, "rxkad - Out of sequence."},
{RXKADNOAUTH, "rxkad - No authentication."},
{RXKADBADKEY, "rxkad - Bad key."},
@@ -273,6 +282,17 @@ static struct koerr koerrmsg[] = {
{KATOOSOON, "ka - password changed too soon"},
{KALOCKED, "ka - account locked"},
+ /* rx errors */
+
+ {ARLA_CALL_DEAD, "rx - call dead"},
+ {ARLA_INVALID_OPERATION, "rx - invalid operation"},
+ {ARLA_CALL_TIMEOUT, "rx - call timeout"},
+ {ARLA_EOF, "rx - end of data"},
+ {ARLA_PROTOCOL_ERROR, "rx - protocol error"},
+ {ARLA_USER_ABORT, "rx - user abort"},
+ {ARLA_ADDRINUSE, "rx - address already in use"},
+ {ARLA_MSGSIZE, "rx - packet too big"},
+
/* Not a known error */
{ 0L, "Unknown error"}
diff --git a/usr.sbin/afs/src/lib/ko/kotest.c b/usr.sbin/afs/src/lib/ko/kotest.c
index b163ea467b8..d4aa5fe93e2 100644
--- a/usr.sbin/afs/src/lib/ko/kotest.c
+++ b/usr.sbin/afs/src/lib/ko/kotest.c
@@ -47,7 +47,7 @@
#include <roken.h>
#include <ko.h>
-RCSID("$KTH: kotest.c,v 1.5 2000/10/02 22:43:19 lha Exp $");
+RCSID("$arla: kotest.c,v 1.8 2002/10/08 23:00:10 lha Exp $");
int
main (int argc, char **argv)
@@ -56,9 +56,9 @@ main (int argc, char **argv)
int ret = 0;
Log_method *method;
- set_progname(argv[0]);
+ setprogname(argv[0]);
- method = log_open(get_progname(), "/dev/stderr");
+ method = log_open(getprogname(), "/dev/stderr");
if (method == NULL)
errx (1, "log_open failed");
cell_init(0, method);
diff --git a/usr.sbin/afs/src/lib/ko/part.c b/usr.sbin/afs/src/lib/ko/part.c
index c537334174d..8d14d1ac1e7 100644
--- a/usr.sbin/afs/src/lib/ko/part.c
+++ b/usr.sbin/afs/src/lib/ko/part.c
@@ -35,7 +35,7 @@
#include "part.h"
-RCSID("$KTH: part.c,v 1.3 2000/10/02 22:43:24 lha Exp $");
+RCSID("$arla: part.c,v 1.3 2000/10/02 22:43:24 lha Exp $");
/*
* partition_num2name
diff --git a/usr.sbin/afs/src/lib/ko/part.h b/usr.sbin/afs/src/lib/ko/part.h
index f472704b3d7..18b45a00c14 100644
--- a/usr.sbin/afs/src/lib/ko/part.h
+++ b/usr.sbin/afs/src/lib/ko/part.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: part.h,v 1.2 2000/10/02 22:43:29 lha Exp $ */
+/* $arla: part.h,v 1.2 2000/10/02 22:43:29 lha Exp $ */
int partition_num2name(int id, char *str, size_t sz);
int partition_name2num(const char *name);
diff --git a/usr.sbin/afs/src/lib/ko/ports.c b/usr.sbin/afs/src/lib/ko/ports.c
index 3ae37e1c2ee..478c44f0560 100644
--- a/usr.sbin/afs/src/lib/ko/ports.c
+++ b/usr.sbin/afs/src/lib/ko/ports.c
@@ -49,7 +49,7 @@
#include "ports.h"
-RCSID("$KTH: ports.c,v 1.10.2.1 2001/04/22 01:21:37 lha Exp $") ;
+RCSID("$arla: ports.c,v 1.12 2001/04/22 01:23:12 lha Exp $") ;
typedef struct {
const char *name; /* Name of the service */
diff --git a/usr.sbin/afs/src/lib/ko/ports.h b/usr.sbin/afs/src/lib/ko/ports.h
index 3b5168c4e68..3fa86b2e6d6 100644
--- a/usr.sbin/afs/src/lib/ko/ports.h
+++ b/usr.sbin/afs/src/lib/ko/ports.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: ports.h,v 1.3 2000/10/02 22:43:39 lha Exp $ */
+/* $arla: ports.h,v 1.3 2000/10/02 22:43:39 lha Exp $ */
/*
* Port numbers.
diff --git a/usr.sbin/afs/src/lib/ko/vlmisc.c b/usr.sbin/afs/src/lib/ko/vlmisc.c
index 8090f6f3b2c..71044fbc65f 100644
--- a/usr.sbin/afs/src/lib/ko/vlmisc.c
+++ b/usr.sbin/afs/src/lib/ko/vlmisc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 - 2001 Kungliga Tekniska Högskolan
+ * Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -32,8 +32,9 @@
*/
#include "ko_locl.h"
+#include <volumeserver.h>
-RCSID("$KTH: vlmisc.c,v 1.3.2.1 2001/03/04 04:07:15 lha Exp $");
+RCSID("$arla: vlmisc.c,v 1.6 2002/05/25 19:12:31 lha Exp $");
/*
* Convert old style vldbentry `old` to newer vldbNentry style `new'
@@ -139,3 +140,81 @@ volname_suffix (int type)
return volsuffixes[type];
}
+
+
+char *
+vol_getopname(int32_t op, char *str, size_t sz)
+{
+ op &= VLOP_ALLOPERS;
+
+ switch(op) {
+ case VLOP_MOVE:
+ strlcpy(str, "move", sz);
+ break;
+ case VLOP_RELEASE:
+ strlcpy(str, "release", sz);
+ break;
+ case VLOP_BACKUP:
+ strlcpy(str, "backup", sz);
+ break;
+ case VLOP_DELETE:
+ strlcpy(str, "delete", sz);
+ break;
+ case VLOP_DUMP:
+ strlcpy(str, "dump", sz);
+ break;
+ default:
+ snprintf(str, sz, "unknown flag %x\n", op);
+ break;
+ }
+ return str;
+}
+
+/*
+ * Print the first of RW, RO, or BACKUP that there's a clone of
+ * according to serverFlag.
+ */
+
+const char *
+volumetype_from_serverflag(int32_t flag)
+{
+ const char *str;
+
+ if (flag & VLSF_RWVOL)
+ str = "RW";
+ else if (flag & VLSF_ROVOL)
+ str = "RO";
+ else if (flag & VLSF_ROVOL)
+ str = "RO";
+ else if (flag & VLSF_BACKVOL)
+ str = "BACKUP";
+ else
+ str = "<unknown>";
+
+ return str;
+}
+
+/*
+ * Convert a volume `type' to a string.
+ */
+
+const char *
+volumetype_from_volsertype(int32_t type)
+{
+ const char *str;
+
+ switch (type) {
+ case RWVOL:
+ str = "RW";
+ break;
+ case ROVOL:
+ str = "RO";
+ break;
+ case BACKVOL:
+ str = "BK";
+ break;
+ default:
+ str = "<unknown>";
+ }
+ return str;
+}
diff --git a/usr.sbin/afs/src/lib/sl/ChangeLog b/usr.sbin/afs/src/lib/sl/ChangeLog
index f26599ddc32..702c19dadda 100644
--- a/usr.sbin/afs/src/lib/sl/ChangeLog
+++ b/usr.sbin/afs/src/lib/sl/ChangeLog
@@ -1,3 +1,11 @@
+2003-02-01 Love <lha@stacken.kth.se>
+
+ * sl.c: use getprogname() not __progname
+
+2002-12-07 Love <lha@stacken.kth.se>
+
+ * Makefile.am: INCLUDES += COMERR_CPPFLAGS
+
2000-12-21 Love <lha@stacken.kth.se>
* Makefile.in: added @LIBS@ to program built localy
diff --git a/usr.sbin/afs/src/lib/sl/lex.l b/usr.sbin/afs/src/lib/sl/lex.l
index 540b04eefb5..aaadfaf0046 100644
--- a/usr.sbin/afs/src/lib/sl/lex.l
+++ b/usr.sbin/afs/src/lib/sl/lex.l
@@ -35,7 +35,7 @@
#include "make_cmds.h"
#include "parse.h"
-RCSID("$KTH: lex.l,v 1.2.4.1 2001/05/28 23:22:54 mattiasa Exp $");
+RCSID("$arla: lex.l,v 1.3 2001/05/26 18:53:18 mattiasa Exp $");
static unsigned lineno = 1;
static int getstring(void);
diff --git a/usr.sbin/afs/src/lib/sl/make_cmds.c b/usr.sbin/afs/src/lib/sl/make_cmds.c
index 57575c6348d..4368f61842e 100644
--- a/usr.sbin/afs/src/lib/sl/make_cmds.c
+++ b/usr.sbin/afs/src/lib/sl/make_cmds.c
@@ -34,7 +34,7 @@
#include "make_cmds.h"
#include <getarg.h>
-RCSID("$KTH: make_cmds.c,v 1.3 2000/09/01 21:29:38 lha Exp $");
+RCSID("$arla: make_cmds.c,v 1.4 2002/04/26 16:11:41 lha Exp $");
#include <roken.h>
#include <err.h>
@@ -213,13 +213,13 @@ main(int argc, char **argv)
{
int optind = 0;
- set_progname(argv[0]);
+ setprogname(argv[0]);
if(getarg(args, sizeof(args)/sizeof(*args), argc, argv, &optind))
usage(1);
if(help_flag)
usage(0);
if(version_flag) {
- printf ("$KTH: make_cmds.c,v 1.3 2000/09/01 21:29:38 lha Exp $\n");
+ printf ("$arla: make_cmds.c,v 1.4 2002/04/26 16:11:41 lha Exp $\n");
exit(0);
}
diff --git a/usr.sbin/afs/src/lib/sl/make_cmds.h b/usr.sbin/afs/src/lib/sl/make_cmds.h
index 2537daba4e0..17efb8044fd 100644
--- a/usr.sbin/afs/src/lib/sl/make_cmds.h
+++ b/usr.sbin/afs/src/lib/sl/make_cmds.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: make_cmds.h,v 1.2 2000/06/27 02:41:11 assar Exp $ */
+/* $arla: make_cmds.h,v 1.2 2000/06/27 02:41:11 assar Exp $ */
#ifndef __MAKE_CMDS_H__
#define __MAKE_CMDS_H__
diff --git a/usr.sbin/afs/src/lib/sl/parse.y b/usr.sbin/afs/src/lib/sl/parse.y
index f8ab2dd2f9c..2b5a57c827f 100644
--- a/usr.sbin/afs/src/lib/sl/parse.y
+++ b/usr.sbin/afs/src/lib/sl/parse.y
@@ -33,7 +33,7 @@
*/
#include "make_cmds.h"
-RCSID("$KTH: parse.y,v 1.2 2000/06/27 02:41:12 assar Exp $");
+RCSID("$arla: parse.y,v 1.2 2000/06/27 02:41:12 assar Exp $");
static void yyerror (char *s);
diff --git a/usr.sbin/afs/src/lib/sl/sl.c b/usr.sbin/afs/src/lib/sl/sl.c
index bb07c2e1887..e8bf933a156 100644
--- a/usr.sbin/afs/src/lib/sl/sl.c
+++ b/usr.sbin/afs/src/lib/sl/sl.c
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: sl.c,v 1.8 2000/03/07 22:08:48 assar Exp $");
+RCSID("$arla: sl.c,v 1.9 2003/02/01 19:19:01 lha Exp $");
#endif
#include "sl_locl.h"
@@ -73,8 +73,8 @@ mandoc_template(SL_cmd *cmds,
t = time(NULL);
strftime(timestr, sizeof(timestr), "%b %d, %Y", localtime(&t));
printf(".Dd %s\n", timestr);
- p = strrchr(__progname, '/');
- if(p) p++; else p = __progname;
+ p = strrchr(getprogname(), '/');
+ if(p) p++; else p = getprogname();
strncpy(cmd, p, sizeof(cmd));
cmd[sizeof(cmd)-1] = '\0';
strupr(cmd);
diff --git a/usr.sbin/afs/src/lib/sl/sl.h b/usr.sbin/afs/src/lib/sl/sl.h
index 3132c6c155b..27b71df5e17 100644
--- a/usr.sbin/afs/src/lib/sl/sl.h
+++ b/usr.sbin/afs/src/lib/sl/sl.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: sl.h,v 1.4 2000/03/07 22:08:48 assar Exp $ */
+/* $arla: sl.h,v 1.4 2000/03/07 22:08:48 assar Exp $ */
#ifndef _SL_H
#define _SL_H
diff --git a/usr.sbin/afs/src/lib/sl/sl_locl.h b/usr.sbin/afs/src/lib/sl/sl_locl.h
index e977b093a14..fa264357d66 100644
--- a/usr.sbin/afs/src/lib/sl/sl_locl.h
+++ b/usr.sbin/afs/src/lib/sl/sl_locl.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: sl_locl.h,v 1.2 2000/03/07 22:08:48 assar Exp $ */
+/* $arla: sl_locl.h,v 1.2 2000/03/07 22:08:48 assar Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
diff --git a/usr.sbin/afs/src/lib/sl/ss.c b/usr.sbin/afs/src/lib/sl/ss.c
index 573735af4b4..d47c9748830 100644
--- a/usr.sbin/afs/src/lib/sl/ss.c
+++ b/usr.sbin/afs/src/lib/sl/ss.c
@@ -39,7 +39,7 @@
#endif
#include "ss.h"
-RCSID("$KTH: ss.c,v 1.2 2000/06/17 03:14:59 assar Exp $");
+RCSID("$arla: ss.c,v 1.2 2000/06/17 03:14:59 assar Exp $");
struct ss_subst {
char *name;
diff --git a/usr.sbin/afs/src/lib/sl/ss.h b/usr.sbin/afs/src/lib/sl/ss.h
index ca40190fd16..f656f99fba5 100644
--- a/usr.sbin/afs/src/lib/sl/ss.h
+++ b/usr.sbin/afs/src/lib/sl/ss.h
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $KTH: ss.h,v 1.1 2000/03/07 22:08:49 assar Exp $ */
+/* $arla: ss.h,v 1.1 2000/03/07 22:08:49 assar Exp $ */
/* SS compatibility for SL */