[BACK]Return to monitor_wrap.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/monitor_wrap.c between version 1.31.2.1 and 1.31.2.2

version 1.31.2.1, 2004/02/28 03:51:33 version 1.31.2.2, 2004/08/19 22:37:31
Line 63 
Line 63 
 extern z_stream outgoing_stream;  extern z_stream outgoing_stream;
 extern struct monitor *pmonitor;  extern struct monitor *pmonitor;
 extern Buffer input, output;  extern Buffer input, output;
   extern Buffer loginmsg;
   
 int  int
 mm_is_monitor(void)  mm_is_monitor(void)
Line 75 
Line 76 
 }  }
   
 void  void
 mm_request_send(int socket, enum monitor_reqtype type, Buffer *m)  mm_request_send(int sock, enum monitor_reqtype type, Buffer *m)
 {  {
         u_int mlen = buffer_len(m);          u_int mlen = buffer_len(m);
         u_char buf[5];          u_char buf[5];
Line 84 
Line 85 
   
         PUT_32BIT(buf, mlen + 1);          PUT_32BIT(buf, mlen + 1);
         buf[4] = (u_char) type;         /* 1st byte of payload is mesg-type */          buf[4] = (u_char) type;         /* 1st byte of payload is mesg-type */
         if (atomicio(vwrite, socket, buf, sizeof(buf)) != sizeof(buf))          if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf))
                 fatal("%s: write", __func__);                  fatal("%s: write", __func__);
         if (atomicio(vwrite, socket, buffer_ptr(m), mlen) != mlen)          if (atomicio(vwrite, sock, buffer_ptr(m), mlen) != mlen)
                 fatal("%s: write", __func__);                  fatal("%s: write", __func__);
 }  }
   
 void  void
 mm_request_receive(int socket, Buffer *m)  mm_request_receive(int sock, Buffer *m)
 {  {
         u_char buf[4];          u_char buf[4];
         u_int msg_len;          u_int msg_len;
Line 99 
Line 100 
   
         debug3("%s entering", __func__);          debug3("%s entering", __func__);
   
         res = atomicio(read, socket, buf, sizeof(buf));          res = atomicio(read, sock, buf, sizeof(buf));
         if (res != sizeof(buf)) {          if (res != sizeof(buf)) {
                 if (res == 0)                  if (res == 0)
                         cleanup_exit(255);                          cleanup_exit(255);
Line 110 
Line 111 
                 fatal("%s: read: bad msg_len %d", __func__, msg_len);                  fatal("%s: read: bad msg_len %d", __func__, msg_len);
         buffer_clear(m);          buffer_clear(m);
         buffer_append_space(m, msg_len);          buffer_append_space(m, msg_len);
         res = atomicio(read, socket, buffer_ptr(m), msg_len);          res = atomicio(read, sock, buffer_ptr(m), msg_len);
         if (res != msg_len)          if (res != msg_len)
                 fatal("%s: read: %ld != msg_len", __func__, (long)res);                  fatal("%s: read: %ld != msg_len", __func__, (long)res);
 }  }
   
 void  void
 mm_request_receive_expect(int socket, enum monitor_reqtype type, Buffer *m)  mm_request_receive_expect(int sock, enum monitor_reqtype type, Buffer *m)
 {  {
         u_char rtype;          u_char rtype;
   
         debug3("%s entering: type %d", __func__, type);          debug3("%s entering: type %d", __func__, type);
   
         mm_request_receive(socket, m);          mm_request_receive(sock, m);
         rtype = buffer_get_char(m);          rtype = buffer_get_char(m);
         if (rtype != type)          if (rtype != type)
                 fatal("%s: read: rtype %d != type %d", __func__,                  fatal("%s: read: rtype %d != type %d", __func__,
Line 186 
Line 187 
 }  }
   
 struct passwd *  struct passwd *
 mm_getpwnamallow(const char *login)  mm_getpwnamallow(const char *username)
 {  {
         Buffer m;          Buffer m;
         struct passwd *pw;          struct passwd *pw;
Line 195 
Line 196 
         debug3("%s entering", __func__);          debug3("%s entering", __func__);
   
         buffer_init(&m);          buffer_init(&m);
         buffer_put_cstring(&m, login);          buffer_put_cstring(&m, username);
   
         mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PWNAM, &m);          mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PWNAM, &m);
   
Line 534 
Line 535 
 }  }
   
 void  void
 mm_send_keystate(struct monitor *pmonitor)  mm_send_keystate(struct monitor *monitor)
 {  {
         Buffer m;          Buffer m;
         u_char *blob, *p;          u_char *blob, *p;
Line 570 
Line 571 
                 goto skip;                  goto skip;
         } else {          } else {
                 /* Kex for rekeying */                  /* Kex for rekeying */
                 mm_send_kex(&m, *pmonitor->m_pkex);                  mm_send_kex(&m, *monitor->m_pkex);
         }          }
   
         debug3("%s: Sending new keys: %p %p",          debug3("%s: Sending new keys: %p %p",
Line 622 
Line 623 
         buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input));          buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input));
         buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output));          buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output));
   
         mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m);          mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m);
         debug3("%s: Finished sending state", __func__);          debug3("%s: Finished sending state", __func__);
   
         buffer_free(&m);          buffer_free(&m);
Line 632 
Line 633 
 mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)  mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
 {  {
         Buffer m;          Buffer m;
         char *p;          char *p, *msg;
         int success = 0;          int success = 0;
   
         buffer_init(&m);          buffer_init(&m);
Line 648 
Line 649 
                 return (0);                  return (0);
         }          }
         p = buffer_get_string(&m, NULL);          p = buffer_get_string(&m, NULL);
           msg = buffer_get_string(&m, NULL);
         buffer_free(&m);          buffer_free(&m);
   
         strlcpy(namebuf, p, namebuflen); /* Possible truncation */          strlcpy(namebuf, p, namebuflen); /* Possible truncation */
         xfree(p);          xfree(p);
   
           buffer_append(&loginmsg, msg, strlen(msg));
           xfree(msg);
   
         *ptyfd = mm_receive_fd(pmonitor->m_recvfd);          *ptyfd = mm_receive_fd(pmonitor->m_recvfd);
         *ttyfd = mm_receive_fd(pmonitor->m_recvfd);          *ttyfd = mm_receive_fd(pmonitor->m_recvfd);
   
Line 781 
Line 786 
         return ((authok == 0) ? -1 : 0);          return ((authok == 0) ? -1 : 0);
 }  }
   
   #ifdef SKEY
 int  int
 mm_skey_query(void *ctx, char **name, char **infotxt,  mm_skey_query(void *ctx, char **name, char **infotxt,
    u_int *numprompts, char ***prompts, u_int **echo_on)     u_int *numprompts, char ***prompts, u_int **echo_on)
Line 844 
Line 850 
   
         return ((authok == 0) ? -1 : 0);          return ((authok == 0) ? -1 : 0);
 }  }
   #endif /* SKEY */
   
 void  void
 mm_ssh1_session_id(u_char session_id[16])  mm_ssh1_session_id(u_char session_id[16])
Line 960 
Line 967 
   
 #ifdef GSSAPI  #ifdef GSSAPI
 OM_uint32  OM_uint32
 mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid)  mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID goid)
 {  {
         Buffer m;          Buffer m;
         OM_uint32 major;          OM_uint32 major;
Line 969 
Line 976 
         *ctx = NULL;          *ctx = NULL;
   
         buffer_init(&m);          buffer_init(&m);
         buffer_put_string(&m, oid->elements, oid->length);          buffer_put_string(&m, goid->elements, goid->length);
   
         mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, &m);          mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, &m);
         mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, &m);          mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, &m);

Legend:
Removed from v.1.31.2.1  
changed lines
  Added in v.1.31.2.2