2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
16 #include <afs/pthread_glock.h>
18 #include "../afs/sysincludes.h"
19 #include "../afs/afsincludes.h"
21 #include <sys/types.h>
24 #include <sys/utime.h>
26 #include <WINNT/afssw.h>
28 #include <sys/socket.h>
29 #include <netinet/in.h>
34 #include <arpa/nameser.h>
36 #endif /* AFS_AFSDB_ENV */
37 #endif /* AFS_NT40_ENV */
45 #include <afs/afsutil.h>
46 #include "cellconfig.h"
49 static ParseHostLine();
50 static ParseCellLine();
51 static afsconf_OpenInternal();
52 static afsconf_CloseInternal();
53 static afsconf_Reopen();
55 static struct afsconf_servPair serviceTable [] = {
66 "afsres", 7010, /* residency database for MR-AFS */
67 "afsremio", 7011, /* remote I/O interface for MR-AFS */
68 0, 0 /* insert new services before this spot */
72 * Basic Rule: we touch "<AFSCONF_DIR>/CellServDB" every time we change anything, so
73 * our code can tell if there is new info in the key files, the cell server db
74 * files or any of the other files (and reopen the thing) if the date on
78 /* return port number in network byte order in the low 16 bits of a long; return -1 if not found */
79 static afs_int32 afsconf_FindService(aname)
80 register char *aname; {
81 /* lookup a service name */
83 register struct afsconf_servPair *tsp;
85 #if defined(AFS_OSF_ENV) || defined(AFS_DEC_ENV)
86 ts = getservbyname(aname, "");
88 ts = getservbyname(aname, (char *) 0);
91 /* we found it in /etc/services, so we use this value */
92 return ts->s_port; /* already in network byte order */
95 /* not found in /etc/services, see if it is one of ours */
96 for(tsp = serviceTable;; tsp++) {
97 if (tsp->name == (char *) 0) return -1;
98 if (!strcmp(tsp->name, aname)) return htons(tsp->port);
102 static int TrimLine(abuffer)
110 if (!isspace(tc)) break;
114 strcpy(abuffer, tbuffer);
120 * IsClientConfigDirectory() -- determine if path matches well-known
121 * client configuration directory.
123 static int IsClientConfigDirectory(const char *path)
125 const char *cdir = AFSDIR_CLIENT_ETC_DIRPATH;
128 for (i = 0; cdir[i] != '\0' && path[i] != '\0'; i++) {
129 int cc = tolower(cdir[i]);
130 int pc = tolower(path[i]);
143 /* hit end of one or both; allow mismatch in existence of trailing slash */
144 if (cdir[i] != '\0') {
145 if ((cdir[i] != '\\' && cdir[i] != '/') || (cdir[i + 1] != '\0')) {
149 if (path[i] != '\0') {
150 if ((path[i] != '\\' && path[i] != '/') || (path[i + 1] != '\0')) {
156 #endif /* AFS_NT40_ENV */
159 static int afsconf_Check(adir)
160 register struct afsconf_dir *adir; {
163 register afs_int32 code;
166 /* NT client CellServDB has different file name than NT server or Unix */
167 if (IsClientConfigDirectory(adir->name)) {
168 strcompose(tbuffer, 256,
169 adir->name, "/", AFSDIR_CELLSERVDB_FILE_NTCLIENT, NULL);
171 strcompose(tbuffer, 256,
172 adir->name, "/", AFSDIR_CELLSERVDB_FILE, NULL);
175 strcompose(tbuffer, 256, adir->name, "/", AFSDIR_CELLSERVDB_FILE, NULL);
176 #endif /* AFS_NT40_ENV */
178 code = stat(tbuffer, &tstat);
182 /* did file change? */
183 if (tstat.st_mtime == adir->timeRead) {
186 /* otherwise file has changed, so reopen it */
187 return afsconf_Reopen(adir);
190 /* set modtime on file */
191 static afsconf_Touch(adir)
192 register struct afsconf_dir *adir; {
194 struct timeval tvp[2];
197 /* NT client CellServDB has different file name than NT server or Unix */
198 if (IsClientConfigDirectory(adir->name)) {
199 strcompose(tbuffer, 256,
200 adir->name, "/", AFSDIR_CELLSERVDB_FILE_NTCLIENT, NULL);
202 strcompose(tbuffer, 256,
203 adir->name, "/", AFSDIR_CELLSERVDB_FILE, NULL);
206 strcompose(tbuffer, 256, adir->name, "/", AFSDIR_CELLSERVDB_FILE, NULL);
207 #endif /* AFS_NT40_ENV */
209 adir->timeRead = 0; /* just in case */
211 return _utime(tbuffer, NULL);
213 gettimeofday(&tvp[0], NULL);
215 return utimes(tbuffer, tvp);
216 #endif /* AFS_NT40_ENV */
219 struct afsconf_dir *afsconf_Open(adir)
220 register char *adir; {
221 register struct afsconf_dir *tdir;
222 register afs_int32 code;
225 /* zero structure and fill in name; rest is done by internal routine */
226 tdir = (struct afsconf_dir *) malloc(sizeof(struct afsconf_dir));
227 bzero(tdir, sizeof(struct afsconf_dir));
228 tdir->name = (char *) malloc(strlen(adir)+1);
229 strcpy(tdir->name, adir);
231 code = afsconf_OpenInternal(tdir, 0, 0);
233 char *afsconf_path, *getenv(), afs_confdir[128];
236 /* Check global place only when local Open failed for whatever reason */
237 if (!(afsconf_path = getenv("AFSCONF"))) {
238 /* The "AFSCONF" environment (or contents of "/.AFSCONF") will be typically set to something like "/afs/<cell>/common/etc" where, by convention, the default files for "ThisCell" and "CellServDB" will reside; note that a major drawback is that a given afs client on that cell may NOT contain the same contents... */
243 if (!(home_dir = getenv("HOME"))) {
244 /* Our last chance is the "/.AFSCONF" file */
245 fp = fopen("/.AFSCONF", "r");
249 return (struct afsconf_dir *) 0;
251 fgets(afs_confdir, 128, fp);
256 sprintf(pathname, "%s/%s", home_dir, ".AFSCONF");
257 fp = fopen(pathname, "r");
259 /* Our last chance is the "/.AFSCONF" file */
260 fp = fopen("/.AFSCONF", "r");
264 return (struct afsconf_dir *) 0;
266 fgets(afs_confdir, 128, fp);
269 fgets(afs_confdir, 128, fp);
272 len = strlen(afs_confdir);
276 return (struct afsconf_dir *) 0;
278 if (afs_confdir[len-1] == '\n') {
279 afs_confdir[len-1] = 0;
281 afsconf_path = afs_confdir;
283 tdir->name = (char *) malloc(strlen(afsconf_path)+1);
284 strcpy(tdir->name, afsconf_path);
285 code = afsconf_OpenInternal(tdir, 0, 0);
290 return (struct afsconf_dir *) 0;
298 static int GetCellUnix(struct afsconf_dir *adir)
304 strcompose(tbuffer, 256, adir->name, "/", AFSDIR_THISCELL_FILE, NULL);
305 tf = fopen(tbuffer, "r");
307 rc = fscanf(tf, "%s", tbuffer);
309 adir->cellName = (char *) malloc(strlen(tbuffer)+1);
310 strcpy(adir->cellName, tbuffer);
322 static int GetCellNT(struct afsconf_dir *adir)
324 if (IsClientConfigDirectory(adir->name)) {
325 /* NT client config dir; ThisCell is in registry (no file). */
326 return afssw_GetClientCellName(&adir->cellName);
328 /* NT server config dir; works just like Unix */
329 return GetCellUnix(adir);
332 #endif /* AFS_NT40_ENV */
335 static int afsconf_OpenInternal(adir, cell, clones)
336 register struct afsconf_dir *adir;
341 register char *tp, *bp;
342 register struct afsconf_entry *curEntry;
343 register afs_int32 code;
345 char tbuffer[256], tbuf1[256];
348 /* figure out the cell name */
352 i = GetCellUnix(adir);
358 /* now parse the individual lines */
362 /* NT client/server have a CellServDB that is the same format as Unix.
363 * However, the NT client uses a different file name
365 if (IsClientConfigDirectory(adir->name)) {
366 /* NT client config dir */
367 strcompose(tbuffer, 256,
368 adir->name, "/", AFSDIR_CELLSERVDB_FILE_NTCLIENT, NULL);
370 /* NT server config dir */
371 strcompose(tbuffer, 256,
372 adir->name, "/", AFSDIR_CELLSERVDB_FILE, NULL);
375 strcompose(tbuffer, 256, adir->name, "/", AFSDIR_CELLSERVDB_FILE, NULL);
376 #endif /* AFS_NT40_ENV */
378 if (!stat(tbuffer, &tstat)) {
379 adir->timeRead = tstat.st_mtime;
384 strcpy(tbuf1, tbuffer);
385 tf = fopen(tbuffer, "r");
390 tp = fgets(tbuffer, sizeof(tbuffer), tf);
392 TrimLine(tbuffer); /* remove white space */
393 if (tbuffer[0] == 0 || tbuffer[0] == '\n') continue; /* empty line */
394 if (tbuffer[0] == '>') {
395 char linkedcell[MAXCELLCHARS];
396 /* start new cell item */
398 /* thread this guy on the list */
399 curEntry->next = adir->entries;
400 adir->entries = curEntry;
403 curEntry = (struct afsconf_entry *) malloc(sizeof(struct afsconf_entry));
404 bzero(curEntry, sizeof(struct afsconf_entry));
405 code = ParseCellLine(tbuffer, curEntry->cellInfo.name, linkedcell);
407 afsconf_CloseInternal(adir);
411 if (linkedcell[0] != '\0') {
412 curEntry->cellInfo.linkedCell =
413 (char *) malloc(strlen(linkedcell) + 1);
414 strcpy(curEntry->cellInfo.linkedCell, linkedcell);
418 /* new host in the current cell */
420 afsconf_CloseInternal(adir);
424 i = curEntry->cellInfo.numServers;
425 if (cell && !strcmp(cell, curEntry->cellInfo.name))
426 code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i], &clones[i]);
428 code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i], 0);
430 if (code == AFSCONF_SYNTAX) {
431 for (bp=tbuffer; *bp != '\n'; bp++) { /* Take out the <cr> from the buffer */
435 fprintf(stderr, "Can't properly parse host line \"%s\" in configuration file %s\n", tbuffer, tbuf1);
439 afsconf_CloseInternal(adir);
442 curEntry->cellInfo.numServers = ++i;
445 fclose(tf); /* close the file now */
447 /* end the last partially-completed cell */
449 curEntry->next = adir->entries;
450 adir->entries = curEntry;
453 /* now read the fs keys, if possible */
454 adir->keystr = (struct afsconf_keys *) 0;
455 afsconf_IntGetKeys(adir);
460 /* parse a line of the form
461 *"128.2.1.3 #hostname" or
462 *"[128.2.1.3] #hostname" for clones
463 * into the appropriate pieces.
465 static ParseHostLine(aline, addr, aname, aclone)
467 register struct sockaddr_in *addr;
471 register afs_int32 code;
475 if (aclone) *aclone = 1;
476 code = sscanf(aline, "[%d.%d.%d.%d] #%s", &c1, &c2, &c3, &c4, aname);
478 if (aclone) *aclone = 0;
479 code = sscanf(aline, "%d.%d.%d.%d #%s", &c1, &c2, &c3, &c4, aname);
481 if (code != 5) return AFSCONF_SYNTAX;
482 addr->sin_family = AF_INET;
484 tp = (char *) &addr->sin_addr;
492 /* parse a line of the form
493 * ">cellname [linkedcellname] [#comments]"
494 * into the appropriate pieces.
496 static ParseCellLine(aline, aname, alname)
497 register char *aline, *aname, *alname; {
499 code = sscanf(aline, ">%s %s", aname, alname);
500 if (code == 1) *alname = '\0';
502 if (*alname == '#') {
506 return (code > 0 ? 0 : AFSCONF_SYNTAX);
509 /* call aproc(entry, arock, adir) for all cells. Proc must return 0, or we'll stop early and return the code it returns */
510 afsconf_CellApply(adir, aproc, arock)
511 struct afsconf_dir *adir;
514 register struct afsconf_entry *tde;
515 register afs_int32 code;
517 for(tde=adir->entries; tde; tde=tde->next) {
518 code = (*aproc)(&tde->cellInfo, arock, adir);
528 afs_int32 afsconf_SawCell = 0;
530 afsconf_GetExtendedCellInfo(adir, acellName, aservice, acellInfo, clones)
531 struct afsconf_dir *adir;
534 struct afsconf_cell *acellInfo;
540 code = afsconf_GetCellInfo(adir, acellName, aservice, acellInfo);
547 cell = (char *) &acellInfo->name;
549 code = afsconf_OpenInternal(adir, cell, clones);
554 afsconf_GetAfsdbInfo(acellName, aservice, acellInfo)
557 struct afsconf_cell *acellInfo;
560 int tservice, len, i;
561 unsigned char answer[1024];
567 /* The resolver isn't always MT-safe.. Perhaps this ought to be
568 * replaced with a more fine-grained lock just for the resolver
572 len = res_search(acellName, C_IN, T_AFSDB, answer, sizeof(answer));
576 return AFSCONF_NOTFOUND;
578 p = answer + sizeof(HEADER); /* Skip header */
579 code = dn_expand(answer, answer + len, p, host, sizeof(host));
581 return AFSCONF_NOTFOUND;
582 strncpy(acellInfo->name, host, sizeof(acellInfo->name));
584 p += code + QFIXEDSZ; /* Skip name */
586 while (p < answer + len) {
589 code = dn_expand(answer, answer + len, p, host, sizeof(host));
591 return AFSCONF_NOTFOUND;
593 p += code; /* Skip the name */
594 type = (p[0] << 8) | p[1];
595 p += 4; /* Skip type and class */
596 ttl = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
597 p += 4; /* Skip the TTL */
598 size = (p[0] << 8) | p[1];
599 p += 2; /* Skip the size */
601 if (type == T_AFSDB) {
605 afsdb_type = (p[0] << 8) | p[1];
606 code = dn_expand(answer, answer+len, p+2, host, sizeof(host));
608 return AFSCONF_NOTFOUND;
610 if ((afsdb_type == 1) &&
611 (server_num < MAXHOSTSPERCELL) &&
612 /* Do we want to get TTL data for the A record as well? */
613 (he = gethostbyname(host))) {
615 memcpy(&ipaddr, he->h_addr, he->h_length);
616 acellInfo->hostAddr[server_num].sin_addr.s_addr = ipaddr;
617 strncpy(acellInfo->hostName[server_num], host,
618 sizeof(acellInfo->hostName[server_num]));
621 if (!minttl || ttl < minttl) minttl = ttl;
628 if (server_num == 0) /* No AFSDB records */
629 return AFSCONF_NOTFOUND;
630 acellInfo->numServers = server_num;
633 tservice = afsconf_FindService(aservice);
635 return AFSCONF_NOTFOUND; /* service not found */
636 for (i=0; i<acellInfo->numServers; i++) {
637 acellInfo->hostAddr[i].sin_port = tservice;
641 acellInfo->timeout = minttl ? (time(0) + minttl) : 0;
645 #endif /* AFS_AFSDB_ENV */
647 afsconf_GetCellInfo(adir, acellName, aservice, acellInfo)
648 struct afsconf_dir *adir;
651 struct afsconf_cell *acellInfo; {
652 register struct afsconf_entry *tce;
653 struct afsconf_entry *bestce;
654 register afs_int32 i;
661 if (adir) afsconf_Check(adir);
664 cnLen = strlen(tcell)+1;
665 lcstring (tcell, tcell, cnLen);
666 afsconf_SawCell = 1; /* will ignore the AFSCELL switch on future */
667 /* call to afsconf_GetLocalCell: like klog */
669 i = afsconf_GetLocalCell(adir, tbuffer, sizeof(tbuffer));
676 cnLen = strlen(tcell);
677 bestce = (struct afsconf_entry *) 0;
683 for(tce=adir->entries;tce;tce=tce->next) {
684 if (strcasecmp(tce->cellInfo.name, tcell) == 0) {
690 if (strlen(tce->cellInfo.name) < cnLen) continue; /* clearly wrong */
691 if (strncasecmp(tce->cellInfo.name, tcell, cnLen) == 0) {
692 if (bestce) ambig = 1; /* ambiguous unless we get exact match */
696 if (!ambig && bestce) {
697 *acellInfo = bestce->cellInfo; /* structure assignment */
699 tservice = afsconf_FindService(aservice);
702 return AFSCONF_NOTFOUND; /* service not found */
704 for(i=0;i<acellInfo->numServers;i++) {
705 acellInfo->hostAddr[i].sin_port = tservice;
708 acellInfo->timeout = 0;
715 return afsconf_GetAfsdbInfo(acellName, aservice, acellInfo);
717 return AFSCONF_NOTFOUND;
718 #endif /* AFS_AFSDB_ENV */
722 afsconf_GetLocalCell(adir, aname, alen)
723 register struct afsconf_dir *adir;
726 static int afsconf_showcell = 0;
733 * If a cell switch was specified in a command, then it should override the
734 * AFSCELL variable. If a cell was specified, then the afsconf_SawCell flag
735 * is set and the cell name in the adir structure is used.
736 * Read the AFSCELL var each time: in case it changes (unsetenv AFSCELL).
738 if ( !afsconf_SawCell && (afscell_path= getenv("AFSCELL")) ) {
739 if ( !afsconf_showcell ) {
740 fprintf(stderr, "Note: Operation is performed on cell %s\n", afscell_path);
741 afsconf_showcell = 1;
743 strncpy(aname, afscell_path, alen);
746 if (adir->cellName) {
747 strncpy(aname, adir->cellName, alen);
749 else code = AFSCONF_UNKNOWN;
757 struct afsconf_dir *adir; {
759 afsconf_CloseInternal(adir);
760 if (adir->name) free(adir->name);
766 static int afsconf_CloseInternal(adir)
767 register struct afsconf_dir *adir; {
768 register struct afsconf_entry *td, *nd;
769 register char *tname;
771 tname = adir->name; /* remember name, since that's all we preserve */
773 /* free everything we can find */
774 if (adir->cellName) free(adir->cellName);
775 for(td=adir->entries;td;td=nd) {
777 if (td->cellInfo.linkedCell)
778 free(td->cellInfo.linkedCell);
781 if (adir->keystr) free(adir->keystr);
784 bzero(adir, sizeof(struct afsconf_dir));
785 adir->name = tname; /* restore it */
789 static int afsconf_Reopen(adir)
790 register struct afsconf_dir *adir; {
791 register afs_int32 code;
792 code = afsconf_CloseInternal(adir);
793 if (code) return code;
794 code = afsconf_OpenInternal(adir, 0, 0);
798 /* called during opening of config file */
799 afsconf_IntGetKeys(adir)
800 struct afsconf_dir *adir;
804 struct afsconf_keys *tstr;
805 register afs_int32 code;
808 /* NT client config dir has no KeyFile; don't risk attempting open
809 * because there might be a random file of this name if dir is shared.
811 if (IsClientConfigDirectory(adir->name)) {
812 adir->keystr = ((struct afsconf_keys *)
813 malloc(sizeof(struct afsconf_keys)));
814 adir->keystr->nkeys = 0;
817 #endif /* AFS_NT40_ENV */
820 /* compute the key name and other setup */
822 strcompose(tbuffer, 256, adir->name, "/", AFSDIR_KEY_FILE, NULL);
823 tstr = (struct afsconf_keys *) malloc(sizeof (struct afsconf_keys));
827 fd = open(tbuffer, O_RDONLY);
833 code = read(fd, tstr, sizeof(struct afsconf_keys));
835 if (code < sizeof(afs_int32)) {
841 /* convert key structure to host order */
842 tstr->nkeys = ntohl(tstr->nkeys);
843 for(fd=0;fd<tstr->nkeys;fd++)
844 tstr->key[fd].kvno = ntohl(tstr->key[fd].kvno);
850 /* get keys structure */
851 afsconf_GetKeys(adir, astr)
852 struct afsconf_dir *adir;
853 struct afsconf_keys *astr;
855 register afs_int32 code;
858 code = afsconf_Check(adir);
860 return AFSCONF_FAILURE;
861 bcopy(adir->keystr, astr, sizeof(struct afsconf_keys));
867 afs_int32 afsconf_GetLatestKey(adir, avno, akey)
868 IN struct afsconf_dir *adir;
874 register struct afsconf_key *tk;
875 register afs_int32 best;
876 struct afsconf_key *bestk;
877 register afs_int32 code;
880 code = afsconf_Check(adir);
882 return AFSCONF_FAILURE;
883 maxa = adir->keystr->nkeys;
885 best = -1; /* highest kvno we've seen yet */
886 bestk = (struct afsconf_key *) 0; /* ptr to structure providing best */
887 for(tk = adir->keystr->key,i=0;i<maxa;i++,tk++) {
888 if (tk->kvno == 999) continue; /* skip bcrypt keys */
889 if (tk->kvno > best) {
894 if (bestk) { /* found any */
895 if (akey) bcopy(bestk->key, akey, 8); /* copy out latest key */
896 if (avno) *avno = bestk->kvno; /* and kvno to caller */
901 return AFSCONF_NOTFOUND; /* didn't find any keys */
904 /* get a particular key */
905 afsconf_GetKey(adir, avno, akey)
906 struct afsconf_dir *adir;
910 register int i, maxa;
911 register struct afsconf_key *tk;
912 register afs_int32 code;
915 code = afsconf_Check(adir);
917 return AFSCONF_FAILURE;
918 maxa = adir->keystr->nkeys;
920 for(tk = adir->keystr->key,i=0;i<maxa;i++,tk++) {
921 if (tk->kvno == avno) {
922 bcopy(tk->key, akey, 8);
929 return AFSCONF_NOTFOUND;
932 /* save the key structure in the appropriate file */
933 static SaveKeys(adir)
934 struct afsconf_dir *adir;
936 struct afsconf_keys tkeys;
938 register afs_int32 i;
941 bcopy(adir->keystr, &tkeys, sizeof(struct afsconf_keys));
943 /* convert it to net byte order */
944 for(i = 0; i<tkeys.nkeys; i++ )
945 tkeys.key[i].kvno = htonl(tkeys.key[i].kvno);
946 tkeys.nkeys = htonl(tkeys.nkeys);
948 /* rewrite keys file */
949 strcompose(tbuffer, 256, adir->name, "/", AFSDIR_KEY_FILE, NULL);
950 fd = open(tbuffer, O_RDWR | O_CREAT | O_TRUNC, 0600);
951 if (fd < 0) return AFSCONF_FAILURE;
952 i = write(fd, &tkeys, sizeof(tkeys));
953 if (i != sizeof(tkeys)) {
955 return AFSCONF_FAILURE;
957 if (close(fd) < 0) return AFSCONF_FAILURE;
961 afsconf_AddKey(adir, akvno, akey, overwrite)
962 struct afsconf_dir *adir;
963 afs_int32 akvno, overwrite;
966 register struct afsconf_keys *tk;
967 register struct afsconf_key *tkey;
968 register afs_int32 i;
975 if (akvno < 0 || akvno > 255) {
981 for(i=0, tkey = tk->key; i<tk->nkeys; i++, tkey++) {
982 if (tkey->kvno == akvno) {
985 return AFSCONF_KEYINUSE;
992 if (tk->nkeys >= AFSCONF_MAXKEYS) {
996 tkey = &tk->key[tk->nkeys++];
999 bcopy(akey, tkey->key, 8);
1001 afsconf_Touch(adir);
1006 /* this proc works by sliding the other guys down, rather than using a funny
1007 kvno value, so that callers can count on getting a good key in key[0].
1009 afsconf_DeleteKey(adir, akvno)
1010 struct afsconf_dir *adir;
1013 register struct afsconf_keys *tk;
1014 register struct afsconf_key *tkey;
1021 for(i=0, tkey = tk->key; i<tk->nkeys; i++, tkey++) {
1022 if (tkey->kvno == akvno) {
1029 return AFSCONF_NOTFOUND;
1032 /* otherwise slide the others down. i and tkey point at the guy to delete */
1033 for(;i<tk->nkeys-1; i++,tkey++) {
1034 tkey->kvno = (tkey+1)->kvno;
1035 bcopy((tkey+1)->key, tkey->key, 8);
1039 afsconf_Touch(adir);