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

Diff for /src/usr.bin/ssh/monitor.c between version 1.165 and 1.166

version 1.165, 2016/09/05 13:57:31 version 1.166, 2016/09/28 16:33:06
Line 70 
Line 70 
 #include "misc.h"  #include "misc.h"
 #include "servconf.h"  #include "servconf.h"
 #include "monitor.h"  #include "monitor.h"
 #include "monitor_mm.h"  
 #ifdef GSSAPI  #ifdef GSSAPI
 #include "ssh-gss.h"  #include "ssh-gss.h"
 #endif  #endif
Line 335 
Line 334 
                 monitor_read(pmonitor, mon_dispatch, NULL);                  monitor_read(pmonitor, mon_dispatch, NULL);
 }  }
   
 void  
 monitor_sync(struct monitor *pmonitor)  
 {  
         if (options.compression) {  
                 /* The member allocation is not visible, so sync it */  
                 mm_share_sync(&pmonitor->m_zlib, &pmonitor->m_zback);  
         }  
 }  
   
 /* Allocation functions for zlib */  
 static void *  
 mm_zalloc(struct mm_master *mm, u_int ncount, u_int size)  
 {  
         if (size == 0 || ncount == 0 || ncount > SIZE_MAX / size)  
                 fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size);  
   
         return mm_malloc(mm, size * ncount);  
 }  
   
 static void  
 mm_zfree(struct mm_master *mm, void *address)  
 {  
         mm_free(mm, address);  
 }  
   
 static int  static int
 monitor_read_log(struct monitor *pmonitor)  monitor_read_log(struct monitor *pmonitor)
 {  {
Line 1292 
Line 1266 
                 kex->host_key_index=&get_hostkey_index;                  kex->host_key_index=&get_hostkey_index;
                 kex->sign = sshd_hostkey_sign;                  kex->sign = sshd_hostkey_sign;
         }          }
   
         /* Update with new address */  
         if (options.compression) {  
                 ssh_packet_set_compress_hooks(ssh, pmonitor->m_zlib,  
                     (ssh_packet_comp_alloc_func *)mm_zalloc,  
                     (ssh_packet_comp_free_func *)mm_zfree);  
         }  
 }  }
   
 /* This function requries careful sanity checking */  /* This function requries careful sanity checking */
Line 1351 
Line 1318 
 struct monitor *  struct monitor *
 monitor_init(void)  monitor_init(void)
 {  {
         struct ssh *ssh = active_state;                 /* XXX */  
         struct monitor *mon;          struct monitor *mon;
   
         mon = xcalloc(1, sizeof(*mon));          mon = xcalloc(1, sizeof(*mon));
   
         monitor_openfds(mon, 1);          monitor_openfds(mon, 1);
   
         /* Used to share zlib space across processes */  
         if (options.compression) {  
                 mon->m_zback = mm_create(NULL, MM_MEMSIZE);  
                 mon->m_zlib = mm_create(mon->m_zback, 20 * MM_MEMSIZE);  
   
                 /* Compression needs to share state across borders */  
                 ssh_packet_set_compress_hooks(ssh, mon->m_zlib,  
                     (ssh_packet_comp_alloc_func *)mm_zalloc,  
                     (ssh_packet_comp_free_func *)mm_zfree);  
         }  
   
         return mon;          return mon;
 }  }

Legend:
Removed from v.1.165  
changed lines
  Added in v.1.166