summaryrefslogtreecommitdiff
path: root/authfd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>1999-12-07 15:38:31 +1100
committerDamien Miller <djm@mindrot.org>1999-12-07 15:38:31 +1100
commit037a0dc0835bb5a442bdcbeecdd5baed723f0b45 (patch)
treed02954d57ac437fd036e3e9544f24559ca8f0f0f /authfd.c
parenteabf3417bc73ca9546a3ed489cd809ffdf303853 (diff)
- Merged more OpenBSD changes:
- [atomicio.c authfd.c scp.c serverloop.c ssh.h sshconnect.c sshd.c] move atomicio into it's own file. wrap all socket write()s which were doing write(sock, buf, len) != len, with atomicio() calls. - [auth-skey.c] fd leak - [authfile.c] properly name fd variable - [channels.c] display great hatred towards strcpy - [pty.c pty.h sshd.c] use openpty() if it exists (it does on BSD4_4) - [tildexpand.c] check for ~ expansion past MAXPATHLEN - Modified helper.c to use new atomicio function. - Reformat Makefile a little - Moved RC4 routines from rc4.[ch] into helper.c - Added autoconf code to detect /dev/ptmx (Solaris) and /dev/ptc (AIX)
Diffstat (limited to 'authfd.c')
-rw-r--r--authfd.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/authfd.c b/authfd.c
index ee6473d32..1a62c3ed0 100644
--- a/authfd.c
+++ b/authfd.c
@@ -14,7 +14,7 @@
14 */ 14 */
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$Id: authfd.c,v 1.8 1999/11/25 00:54:57 damien Exp $"); 17RCSID("$Id: authfd.c,v 1.9 1999/12/07 04:38:32 damien Exp $");
18 18
19#include "ssh.h" 19#include "ssh.h"
20#include "rsa.h" 20#include "rsa.h"
@@ -145,7 +145,7 @@ ssh_get_first_identity(AuthenticationConnection *auth,
145 msg[2] = 0; 145 msg[2] = 0;
146 msg[3] = 1; 146 msg[3] = 1;
147 msg[4] = SSH_AGENTC_REQUEST_RSA_IDENTITIES; 147 msg[4] = SSH_AGENTC_REQUEST_RSA_IDENTITIES;
148 if (write(auth->fd, msg, 5) != 5) { 148 if (atomicio(write, auth->fd, msg, 5) != 5) {
149 error("write auth->fd: %.100s", strerror(errno)); 149 error("write auth->fd: %.100s", strerror(errno));
150 return 0; 150 return 0;
151 } 151 }
@@ -270,9 +270,9 @@ ssh_decrypt_challenge(AuthenticationConnection *auth,
270 PUT_32BIT(buf, len); 270 PUT_32BIT(buf, len);
271 271
272 /* Send the length and then the packet to the agent. */ 272 /* Send the length and then the packet to the agent. */
273 if (write(auth->fd, buf, 4) != 4 || 273 if (atomicio(write, auth->fd, buf, 4) != 4 ||
274 write(auth->fd, buffer_ptr(&buffer), buffer_len(&buffer)) != 274 atomicio(write, auth->fd, buffer_ptr(&buffer),
275 buffer_len(&buffer)) { 275 buffer_len(&buffer)) != buffer_len(&buffer)) {
276 error("Error writing to authentication socket."); 276 error("Error writing to authentication socket.");
277error_cleanup: 277error_cleanup:
278 buffer_free(&buffer); 278 buffer_free(&buffer);
@@ -369,9 +369,9 @@ ssh_add_identity(AuthenticationConnection *auth,
369 PUT_32BIT(buf, len); 369 PUT_32BIT(buf, len);
370 370
371 /* Send the length and then the packet to the agent. */ 371 /* Send the length and then the packet to the agent. */
372 if (write(auth->fd, buf, 4) != 4 || 372 if (atomicio(write, auth->fd, buf, 4) != 4 ||
373 write(auth->fd, buffer_ptr(&buffer), buffer_len(&buffer)) != 373 atomicio(write, auth->fd, buffer_ptr(&buffer),
374 buffer_len(&buffer)) { 374 buffer_len(&buffer)) != buffer_len(&buffer)) {
375 error("Error writing to authentication socket."); 375 error("Error writing to authentication socket.");
376error_cleanup: 376error_cleanup:
377 buffer_free(&buffer); 377 buffer_free(&buffer);
@@ -450,9 +450,9 @@ ssh_remove_identity(AuthenticationConnection *auth, RSA *key)
450 PUT_32BIT(buf, len); 450 PUT_32BIT(buf, len);
451 451
452 /* Send the length and then the packet to the agent. */ 452 /* Send the length and then the packet to the agent. */
453 if (write(auth->fd, buf, 4) != 4 || 453 if (atomicio(write, auth->fd, buf, 4) != 4 ||
454 write(auth->fd, buffer_ptr(&buffer), buffer_len(&buffer)) != 454 atomicio(write, auth->fd, buffer_ptr(&buffer),
455 buffer_len(&buffer)) { 455 buffer_len(&buffer)) != buffer_len(&buffer)) {
456 error("Error writing to authentication socket."); 456 error("Error writing to authentication socket.");
457error_cleanup: 457error_cleanup:
458 buffer_free(&buffer); 458 buffer_free(&buffer);
@@ -526,7 +526,7 @@ ssh_remove_all_identities(AuthenticationConnection *auth)
526 buf[4] = SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES; 526 buf[4] = SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES;
527 527
528 /* Send the length and then the packet to the agent. */ 528 /* Send the length and then the packet to the agent. */
529 if (write(auth->fd, buf, 5) != 5) { 529 if (atomicio(write, auth->fd, buf, 5) != 5) {
530 error("Error writing to authentication socket."); 530 error("Error writing to authentication socket.");
531 return 0; 531 return 0;
532 } 532 }