more error testing from Love Hörnquist-Åstrand <e96_lho@elixir.e.kth.se>
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4180 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -264,11 +264,13 @@ create_and_write_cookie (char *xauthfile,
|
|||||||
auth.data = (char*)cookie;
|
auth.data = (char*)cookie;
|
||||||
des_rand_data (cookie, sz);
|
des_rand_data (cookie, sz);
|
||||||
|
|
||||||
strncpy(xauthfile, "/tmp/AXXXXX", size);
|
strncpy(xauthfile, "/tmp/AXXXXXX", size);
|
||||||
xauthfile[size-1] = 0;
|
xauthfile[size-1] = 0;
|
||||||
fd = mkstemp(xauthfile);
|
fd = mkstemp(xauthfile);
|
||||||
if(fd < 0)
|
if(fd < 0) {
|
||||||
return 1;
|
syslog(LOG_ERR, "create_and_write_cookie: mkstemp: %m");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
f = fdopen(fd, "r+");
|
f = fdopen(fd, "r+");
|
||||||
if(f == NULL){
|
if(f == NULL){
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@@ -365,8 +365,14 @@ doit(int sock, int tcpp)
|
|||||||
else
|
else
|
||||||
snprintf (display, display_size, ":%u", display_num);
|
snprintf (display, display_size, ":%u", display_num);
|
||||||
if(create_and_write_cookie (xauthfile, xauthfile_size,
|
if(create_and_write_cookie (xauthfile, xauthfile_size,
|
||||||
cookie, cookie_len))
|
cookie, cookie_len)) {
|
||||||
return 1;
|
syslog(LOG_ERR, "create_and_write_cookie: %m");
|
||||||
|
fatal (sock, &key, schedule, &me, &him,
|
||||||
|
"Cookie-creation failed with: %s",
|
||||||
|
strerror(errno));
|
||||||
|
cleanup();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
p = msg;
|
p = msg;
|
||||||
*p++ = ACK;
|
*p++ = ACK;
|
||||||
@@ -382,6 +388,7 @@ doit(int sock, int tcpp)
|
|||||||
if(write_encrypted (sock, msg, p - msg, schedule, &key,
|
if(write_encrypted (sock, msg, p - msg, schedule, &key,
|
||||||
&me, &him) < 0) {
|
&me, &him) < 0) {
|
||||||
syslog (LOG_ERR, "write: %m");
|
syslog (LOG_ERR, "write: %m");
|
||||||
|
cleanup();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
Reference in New Issue
Block a user