various fixes
This commit is contained in:
parent
d1b585cfe2
commit
7f51f90cb3
@ -19,5 +19,5 @@ AUDIO=unix
|
||||
all: default
|
||||
|
||||
libmachdep.a:
|
||||
arch=`uname -m|sed 's/i.86/386/;s/Power Macintosh/power/'`; \
|
||||
arch=`uname -m|sed 's/i.86/386/;s/Power Macintosh/power/; s/x86_64/amd64/'`; \
|
||||
(cd posix-$$arch && make)
|
||||
|
25
cpu.c
25
cpu.c
@ -548,7 +548,7 @@ p9any(int fd)
|
||||
char tbuf[TICKETLEN+TICKETLEN+AUTHENTLEN], trbuf[TICKREQLEN];
|
||||
char authkey[DESKEYLEN];
|
||||
Authenticator auth;
|
||||
int afd, i, v2;
|
||||
int afd, i, n, v2;
|
||||
Ticketreq tr;
|
||||
Ticket t;
|
||||
AuthInfo *ai;
|
||||
@ -623,11 +623,26 @@ p9any(int fd)
|
||||
auth.id = 0;
|
||||
convA2M(&auth, tbuf+TICKETLEN, t.key);
|
||||
|
||||
if(write(fd, tbuf, TICKETLEN+AUTHENTLEN) != TICKETLEN+AUTHENTLEN)
|
||||
if(write(fd, tbuf+1, TICKETLEN+AUTHENTLEN) != TICKETLEN+AUTHENTLEN)
|
||||
fatal(1, "cannot send ticket and authenticator back in p9sk1");
|
||||
|
||||
if(readn(fd, tbuf, AUTHENTLEN) != AUTHENTLEN)
|
||||
fatal(1, "cannot read authenticator in p9sk1");
|
||||
if((n=readn(fd, tbuf, AUTHENTLEN)) != AUTHENTLEN ||
|
||||
memcmp(tbuf, "cpu:", 4) == 0){
|
||||
if(n <= 4)
|
||||
fatal(1, "cannot read authenticator in p9sk1");
|
||||
|
||||
/*
|
||||
* didn't send back authenticator:
|
||||
* sent back fatal error message.
|
||||
*/
|
||||
memmove(buf, tbuf, n);
|
||||
i = readn(fd, buf+n, sizeof buf-n-1);
|
||||
if(i > 0)
|
||||
n += i;
|
||||
buf[n] = 0;
|
||||
werrstr("");
|
||||
fatal(0, "server says: %s", buf);
|
||||
}
|
||||
|
||||
convM2A(tbuf, &auth, t.key);
|
||||
if(auth.num != AuthAs
|
||||
@ -635,7 +650,7 @@ p9any(int fd)
|
||||
|| auth.id != 0){
|
||||
print("?you and auth server agree about password.\n");
|
||||
print("?server is confused.\n");
|
||||
fatal(1, "server lies got %llux.%d want %llux.%d", *(vlong*)auth.chal, auth.id, *(vlong*)cchal, 0);
|
||||
fatal(0, "server lies got %llux.%d want %llux.%d", *(vlong*)auth.chal, auth.id, *(vlong*)cchal, 0);
|
||||
}
|
||||
//print("i am %s there.\n", t.suid);
|
||||
ai = mallocz(sizeof(AuthInfo), 1);
|
||||
|
@ -1126,18 +1126,28 @@ if(0) iprint("xselect target=%d requestor=%d property=%d selection=%d\n",
|
||||
XChangeProperty(xd, xe->requestor, xe->property, xe->target,
|
||||
8, PropModeReplace, (uchar*)a, sizeof a);
|
||||
}else if(xe->target == XA_STRING || xe->target == utf8string || xe->target == text || xe->target == compoundtext){
|
||||
text:
|
||||
/* if the target is STRING we're supposed to reply with Latin1 XXX */
|
||||
qlock(&clip.lk);
|
||||
XChangeProperty(xd, xe->requestor, xe->property, xe->target,
|
||||
8, PropModeReplace, (uchar*)clip.buf, strlen(clip.buf));
|
||||
qunlock(&clip.lk);
|
||||
}else{
|
||||
iprint("get %d\n", xe->target);
|
||||
name = XGetAtomName(xd, xe->target);
|
||||
if(name == nil)
|
||||
iprint("XGetAtomName failed\n");
|
||||
else if(strcmp(name, "TIMESTAMP") != 0)
|
||||
iprint("%s: cannot handle selection request for '%s' (%d)\n", argv0, name, (int)xe->target);
|
||||
iprint("XGetAtomName %d failed\n", xe->target);
|
||||
if(name){
|
||||
if(strcmp(name, "TIMESTAMP") == 0){
|
||||
/* nothing */
|
||||
}else if(strncmp(name, "image/", 6) == 0){
|
||||
/* nothing */
|
||||
}else if(strcmp(name, "text/html") == 0){
|
||||
/* nothing */
|
||||
}else if(strcmp(name, "text/plain") == 0 || strcmp(name, "text/plain;charset=UTF-8") == 0){
|
||||
goto text;
|
||||
}else
|
||||
iprint("%s: cannot handle selection request for '%s' (%d)\n", argv0, name, (int)xe->target);
|
||||
}
|
||||
r.xselection.property = None;
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,22 @@
|
||||
#define __BSD_VISIBLE 1 /* FreeBSD 5.x */
|
||||
#define _BSD_SOURCE 1
|
||||
#define _NETBSD_SOURCE 1 /* NetBSD */
|
||||
#define _SVID_SOURCE 1
|
||||
#if !defined(__APPLE__) && !defined(__OpenBSD__)
|
||||
# define _XOPEN_SOURCE 1000
|
||||
# define _XOPEN_SOURCE_EXTENDED 1
|
||||
#endif
|
||||
#define _LARGEFILE64_SOURCE 1
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <fcntl.h>
|
||||
#include <setjmp.h>
|
||||
#include <stddef.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
|
Loading…
Reference in New Issue
Block a user