add import -z option to skip initial tree negotiation (from mycroftiv)
This commit is contained in:
parent
d645d4d81b
commit
182ed8a2b5
2 changed files with 32 additions and 13 deletions
|
@ -68,6 +68,19 @@ is a directory.
|
||||||
Skip the authentication protocol.
|
Skip the authentication protocol.
|
||||||
This is useful for connecting to foreign systems like Inferno.
|
This is useful for connecting to foreign systems like Inferno.
|
||||||
.TP
|
.TP
|
||||||
|
.B -z
|
||||||
|
Bypass the initial protocol request for which remote tree to serve.
|
||||||
|
This is necessary when the remote
|
||||||
|
.IR exportfs (4)
|
||||||
|
is running with the
|
||||||
|
.B -r
|
||||||
|
or
|
||||||
|
.B -S
|
||||||
|
options which pre-select a file tree to serve. The exception is if both sides are
|
||||||
|
operating in the
|
||||||
|
.B -B
|
||||||
|
backwards mode.
|
||||||
|
.TP
|
||||||
.B -B
|
.B -B
|
||||||
Run in ``backwards'' mode, described below.
|
Run in ``backwards'' mode, described below.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -25,6 +25,7 @@ AuthInfo *ai;
|
||||||
int debug;
|
int debug;
|
||||||
int doauth = 1;
|
int doauth = 1;
|
||||||
int timedout;
|
int timedout;
|
||||||
|
int skiptree;
|
||||||
|
|
||||||
int connect(char*, char*, int);
|
int connect(char*, char*, int);
|
||||||
int passive(void);
|
int passive(void);
|
||||||
|
@ -145,6 +146,9 @@ main(int argc, char **argv)
|
||||||
case 'B':
|
case 'B':
|
||||||
backwards = 1;
|
backwards = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'z':
|
||||||
|
skiptree = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
}ARGEND;
|
}ARGEND;
|
||||||
|
@ -315,20 +319,22 @@ connect(char *system, char *tree, int oldserver)
|
||||||
sysfatal("%r: %s", system);
|
sysfatal("%r: %s", system);
|
||||||
}
|
}
|
||||||
|
|
||||||
procsetname("writing tree name %s", tree);
|
if(!skiptree){
|
||||||
n = write(fd, tree, strlen(tree));
|
procsetname("writing tree name %s", tree);
|
||||||
if(n < 0)
|
n = write(fd, tree, strlen(tree));
|
||||||
sysfatal("can't write tree: %r");
|
if(n < 0)
|
||||||
|
sysfatal("can't write tree: %r");
|
||||||
|
|
||||||
strcpy(buf, "can't read tree");
|
strcpy(buf, "can't read tree");
|
||||||
|
|
||||||
procsetname("awaiting OK for %s", tree);
|
procsetname("awaiting OK for %s", tree);
|
||||||
n = read(fd, buf, sizeof buf - 1);
|
n = read(fd, buf, sizeof buf - 1);
|
||||||
if(n!=2 || buf[0]!='O' || buf[1]!='K'){
|
if(n!=2 || buf[0]!='O' || buf[1]!='K'){
|
||||||
if (timedout)
|
if (timedout)
|
||||||
sysfatal("timed out connecting to %s", na);
|
sysfatal("timed out connecting to %s", na);
|
||||||
buf[sizeof buf - 1] = '\0';
|
buf[sizeof buf - 1] = '\0';
|
||||||
sysfatal("bad remote tree: %s", buf);
|
sysfatal("bad remote tree: %s", buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oldserver)
|
if(oldserver)
|
||||||
|
@ -366,7 +372,7 @@ void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprint(2, "usage: import [-abcC] [-A] [-E clear|ssl|tls] "
|
fprint(2, "usage: import [-abcC] [-A] [-E clear|ssl|tls] "
|
||||||
"[-e 'crypt auth'|clear] [-k keypattern] [-p] host remotefs [mountpoint]\n");
|
"[-e 'crypt auth'|clear] [-k keypattern] [-p] [-z] host remotefs [mountpoint]\n");
|
||||||
exits("usage");
|
exits("usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue