#include <afsconfig.h>
#include <afs/param.h>
+#include <afs/stds.h>
+#include <afs/procmgmt.h>
+#include <roken.h>
+#include <afs/opr.h>
+
+#include <hcrypto/ui.h>
-#include <afs/stds.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/types.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#include <io.h>
-#include <fcntl.h>
-#else
-#include <sys/file.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <strings.h>
-#endif /* AFS_NT40_ENV */
-#include <string.h>
-#include <afs/procmgmt.h> /* signal(), kill(), wait(), etc. */
-#include <time.h>
#include "bnode.h"
-#include <errno.h>
#include <afs/afsutil.h>
#include <afs/cellconfig.h>
#include <rx/rx.h>
-#include <sys/stat.h>
#include <rx/xdr.h>
#include <afs/auth.h>
#include <afs/cellconfig.h>
-#include <stdio.h>
#include <afs/cmd.h>
#include <afs/com_err.h>
#include <ubik.h>
#include <afs/ktime.h>
-#include <des.h>
-#include <des_prototypes.h>
#include <afs/kautils.h>
+#include <afs/afsint.h>
#include <afs/volser.h>
static int IStatServer(struct cmd_syndesc *as, int int32p);
int aint32p, int firstTime);
#include "bosint.h"
+#include "bnode_internal.h"
#include "bosprototypes.h"
/* command offsets for bos salvage command */
afs_int32 code;
struct ktc_encryptionKey tkey;
afs_int32 temp;
- char *tcell;
- char cellBuffer[256];
char buf[BUFSIZ], ver[BUFSIZ];
tconn = GetConn(as, 1);
strcpy(buf, as->parms[1].items->data);
else {
/* prompt for key */
- code = des_read_pw_string(buf, sizeof(buf), "input key: ", 0);
+ code = UI_UTIL_read_pw_string(buf, sizeof(buf), "input key: ", 0);
if (code || strlen(buf) == 0) {
fprintf(stderr, "Bad key: \n");
exit(1);
}
- code = des_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0);
+ code = UI_UTIL_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0);
if (code || strlen(ver) == 0) {
fprintf(stderr, "Bad key: \n");
exit(1);
*/
strcpy((char *)&tkey, buf);
} else { /* kerberos key */
+ char *tcell;
if (as->parms[ADDPARMOFFSET].items) {
- strcpy(cellBuffer, as->parms[ADDPARMOFFSET].items->data);
+ tcell = strdup(as->parms[ADDPARMOFFSET].items->data);
+ if (tcell == NULL) {
+ fprintf(stderr, "bos: Unable to allocate memory for cellname\n");
+ exit(1);
+ }
/* string to key needs upper-case cell names */
/* I don't believe this is true. The string to key function
* actually expands the cell name, then LOWER-CASES it. Perhaps it
* didn't use to??? */
- ucstring(cellBuffer, cellBuffer, strlen(cellBuffer));
- tcell = cellBuffer;
+ ucstring(tcell, tcell, strlen(tcell));
} else
tcell = NULL; /* no cell specified, use current */
/*
ka_StringToKey(as->parms[1].items->data, tcell, &tkey);
*/
ka_StringToKey(buf, tcell, &tkey);
+
+ if (tcell)
+ free(tcell);
}
- tconn = GetConn(as, 1);
code = BOZO_AddKey(tconn, temp, ktc_to_bozoptr(&tkey));
if (code) {
printf("bos: failed to set key %d (%s)\n", temp, em(code));
break;
everWorked = 1;
/* first check if key is returned */
- if ((!ka_KeyIsZero(ktc_to_charptr(&tkey), sizeof(tkey))) && (as->parms[1].items)) {
+ if ((!ka_KeyIsZero((char *)&tkey, sizeof(tkey)))
+ && (as->parms[1].items)) {
printf("key %d is '", kvno);
- ka_PrintBytes(ktc_to_charptr(&tkey), sizeof(tkey));
+ ka_PrintBytes((char *)&tkey, sizeof(tkey));
printf("'\n");
} else {
if (keyInfo.keyCheckSum == 0) /* shouldn't happen */
char pbuffer[PARMBUFFERSSIZE];
afs_int32 partNumber;
char *notifier = NONOTIFIER;
+ int count;
/* if a partition was specified, canonicalize the name, since
* the salvager has a stupid partition ID parser */
goto done;
}
/* now wait for bnode to disappear */
+ count = 0;
while (1) {
- IOMGR_Sleep(5);
+ IOMGR_Sleep(1);
tp = tbuffer;
code = BOZO_GetInstanceInfo(aconn, "salvage-tmp", &tp, &istatus);
if (code)
break;
- printf("bos: waiting for salvage to complete.\n");
+ if ((++count % 5) == 0)
+ printf("bos: waiting for salvage to complete.\n");
}
if (code != BZNOENT) {
printf("bos: salvage failed (%s)\n", em(code));
&mrafsParm.OptResidencies);
if (code) {
printf("bos: '%s' is not a valid residency mask.\n",
- as->parms[MRAFS_OFFSET + 13].items->data);
+ as->parms[MRAFS_OFFSET + 17].items->data);
return code;
}
}
confdir =
(localauth ? AFSDIR_SERVER_ETC_DIRPATH :
AFSDIR_CLIENT_ETC_DIRPATH);
- code = vsu_ClientInit( /* noauth */ 1, confdir, tmpname,
- /* server auth */ 0, &cstruct, (int (*)())0);
+
+ code = vsu_ClientInit(confdir, tmpname,
+ AFSCONF_SECOPTS_FALLBACK_NULL |
+ AFSCONF_SECOPTS_NOAUTH,
+ NULL, &cstruct);
+
if (code == 0) {
newID = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
if (newID == 0) {