]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/ip/ftpd.c
[9front] walk: properly format permissions
[plan9front.git] / sys / src / cmd / ip / ftpd.c
index 8626ab47e0a56104765ffe4e8f991b98a371ab33..6661189e9965a4435a25ab330e5be89133fe8147 100644 (file)
@@ -85,6 +85,7 @@ struct Cmd
 Cmd cmdtab[] =
 {
        { "abor",       abortcmd,       0, },
+       { "allo",       nopcmd,         1, },
        { "appe",       appendcmd,      1, },
        { "cdup",       cdupcmd,        1, },
        { "cwd",        cwdcmd,         1, },
@@ -160,14 +161,11 @@ logit(char *fmt, ...)
 {
        char buf[8192];
        va_list arg;
-       char errstr[ERRMAX];
 
-       rerrstr(errstr, sizeof errstr);
        va_start(arg, fmt);
        vseprint(buf, buf+sizeof(buf), fmt, arg);
        va_end(arg);
        syslog(0, FTPLOG, "%s.%s %s", nci->rsys, nci->rserv, buf);
-       werrstr(errstr, sizeof errstr);
 }
 
 static void
@@ -415,10 +413,10 @@ transfer(char *cmd, char *a1, char *a2, char *a3, int image)
                if(isnone){
                        fd = open("#s/boot", ORDWR);
                        if(fd < 0
-                       || bind("#/", "/", MAFTER) < 0
-                       || amount(fd, "/bin", MREPL, "") < 0
-                       || bind("#c", "/dev", MAFTER) < 0
-                       || bind(bindir, "/bin", MREPL) < 0)
+                       || bind("#/", "/", MAFTER) == -1
+                       || amount(fd, "/bin", MREPL, "") == -1
+                       || bind("#c", "/dev", MAFTER) == -1
+                       || bind(bindir, "/bin", MREPL) == -1)
                                exits("building name space");
                        close(fd);
                }
@@ -609,6 +607,7 @@ passcmd(char *response)
 {
        char namefile[128];
        AuthInfo *ai;
+       Dir nd;
 
        if(response == nil)
                response = "";
@@ -635,9 +634,17 @@ passcmd(char *response)
                ch->nresp = strlen(response);
                ai = auth_response(ch);
                if(ai == nil || auth_chuid(ai, nil) < 0) {
+                       auth_freeAI(ai);
                        slowdown();
                        return reply("530 Not logged in: %r");
                }
+               /* chown network connection */
+               nulldir(&nd);
+               nd.mode = 0660;
+               nd.uid = ai->cuid;
+               dirfwstat(0, &nd);
+
+               auth_freeAI(ai);
                auth_freechal(ch);
                ch = nil;
 
@@ -804,12 +811,12 @@ mountnet(void)
 
        rv = 0;
 
-       if(bind("#/", "/", MAFTER) < 0){
+       if(bind("#/", "/", MAFTER) == -1){
                logit("can't bind #/ to /: %r");
                return reply("500 can't bind #/ to /: %r");
        }
 
-       if(bind(nci->spec, "/net", MBEFORE) < 0){
+       if(bind(nci->spec, "/net", MBEFORE) == -1){
                logit("can't bind %s to /net: %r", nci->spec);
                rv = reply("500 can't bind %s to /net: %r", nci->spec);
                unmount("#/", "/");