origargs = procgetname();
/* see if we should use a larger message size */
fd = open("/dev/draw", OREAD);
- if(fd > 0){
+ if(fd >= 0){
ms = iounit(fd);
if(msgsize < ms+IOHDRSZ)
msgsize = ms+IOHDRSZ;
return p-buf;
}
+/*
+ * chown network connection
+ */
+static void
+setnetuser(int fd, char *user)
+{
+ Dir nd;
+ nulldir(&nd);
+ nd.mode = 0660;
+ nd.uid = user;
+ dirfwstat(fd, &nd);
+}
+
/*
* user level challenge/response
*/
writestr(fd, "", "challenge", 1);
if(auth_chuid(ai, 0) < 0)
fatal("newns: %r");
+ setnetuser(fd, ai->cuid);
auth_freeAI(ai);
return fd;
}
return -1;
if(auth_chuid(ai, nil) < 0)
fatal("newns: %r");
+ setnetuser(fd, ai->cuid);
snprint(user, MaxStr, "%s", ai->cuid);
fd = sslsetup(fd, ai->secret, ai->nsecret, 0);
auth_freeAI(ai);