This commit is contained in:
Russ Cox 2005-11-07 17:43:17 +00:00
parent ad9a404582
commit 64b62a3fd4
4 changed files with 13 additions and 23 deletions

28
cpu.c
View File

@ -99,7 +99,7 @@ mountfactotum(void)
void void
cpumain(int argc, char **argv) cpumain(int argc, char **argv)
{ {
char dat[MaxStr], buf[MaxStr], cmd[MaxStr], *p, *err, *secstoreserver, *s; char dat[MaxStr], buf[MaxStr], cmd[MaxStr], *err, *secstoreserver, *s;
int fd, ms, data; int fd, ms, data;
/* see if we should use a larger message size */ /* see if we should use a larger message size */
@ -115,6 +115,12 @@ cpumain(int argc, char **argv)
if(user == nil) if(user == nil)
user = readcons("user", nil, 0); user = readcons("user", nil, 0);
secstoreserver = nil; secstoreserver = nil;
authserver = getenv("auth");
if(authserver == nil)
authserver = "auth";
system = getenv("cpu");
if(system == nil)
system = "cpu";
ARGBEGIN{ ARGBEGIN{
case 'a': case 'a':
authserver = EARGF(usage()); authserver = EARGF(usage());
@ -154,6 +160,9 @@ cpumain(int argc, char **argv)
usage(); usage();
}ARGEND; }ARGEND;
if(argc != 0)
usage();
if(mountfactotum() < 0){ if(mountfactotum() < 0){
if(secstoreserver == nil) if(secstoreserver == nil)
secstoreserver = authserver; secstoreserver = authserver;
@ -167,23 +176,6 @@ cpumain(int argc, char **argv)
} }
} }
if(argc != 0)
usage();
if(system == nil) {
p = getenv("cpu");
if(p == 0)
fatal(0, "set $cpu");
system = p;
}
if(authserver == nil) {
p = getenv("auth");
if(p == 0)
fatal(0, "set $auth");
authserver = p;
}
if((err = rexcall(&data, system, srvname))) if((err = rexcall(&data, system, srvname)))
fatal(1, "%s: %s", err, system); fatal(1, "%s: %s", err, system);

View File

@ -2,7 +2,7 @@ extern int havesecstore(char *addr, char *owner);
extern char *secstore; extern char *secstore;
extern char secstorebuf[65536]; extern char secstorebuf[65536];
extern char *secstorefetch(char *addr, char *owner, char *passwd); extern char *secstorefetch(char *addr, char *owner, char *passwd);
extern char *authaddr; extern char *authserver;
extern char *readcons(char *prompt, char *def, int secret); extern char *readcons(char *prompt, char *def, int secret);
extern int exportfs(int, int); extern int exportfs(int, int);
extern char *user; extern char *user;

2
main.c
View File

@ -6,8 +6,6 @@
#include "drawterm.h" #include "drawterm.h"
char *authaddr = "auth";
char *cpuaddr = "cpu";
char *argv0; char *argv0;
char *user; char *user;

View File

@ -41,9 +41,9 @@ secdial(char *secstore)
* like il!host or tcp!host or host. * like il!host or tcp!host or host.
*/ */
if(strcmp(p, "$auth")==0){ if(strcmp(p, "$auth")==0){
if(authaddr == nil) if(authserver == nil)
return -1; return -1;
strecpy(buf, buf+sizeof buf, authaddr); strecpy(buf, buf+sizeof buf, authserver);
nf = getfields(buf, f, nelem(f), 0, "!"); nf = getfields(buf, f, nelem(f), 0, "!");
switch(nf){ switch(nf){
default: default: