Print this page
1575 untangle libmlrpc ... pre1:
 Move srvsvc_timecheck where it belongs

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_client.c
          +++ new/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_client.c
↓ open down ↓ 23 lines elided ↑ open up ↑
  24   24   * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  25   25   */
  26   26  
  27   27  /*
  28   28   * Client NDR RPC interface.
  29   29   */
  30   30  
  31   31  #include <sys/types.h>
  32   32  #include <sys/errno.h>
  33   33  #include <sys/fcntl.h>
  34      -#include <sys/tzfile.h>
  35   34  #include <time.h>
  36   35  #include <strings.h>
  37   36  #include <assert.h>
  38   37  #include <errno.h>
  39   38  #include <thread.h>
  40      -#include <unistd.h>
  41   39  #include <syslog.h>
  42   40  #include <synch.h>
  43   41  
  44   42  #include <netsmb/smbfs_api.h>
  45   43  #include <smbsrv/libsmb.h>
  46   44  #include <smbsrv/libsmbns.h>
  47   45  #include <smbsrv/libmlrpc.h>
  48   46  #include <smbsrv/libmlsvc.h>
  49   47  #include <smbsrv/ndl/srvsvc.ndl>
  50   48  #include <libsmbrdr.h>
↓ open down ↓ 545 lines elided ↑ open up ↑
 596  594   */
 597  595  static void
 598  596  ndr_xa_release(ndr_client_t *clnt)
 599  597  {
 600  598          if (clnt->heap_preserved) {
 601  599                  ndr_heap_destroy(clnt->heap);
 602  600                  clnt->heap = NULL;
 603  601                  clnt->heap_preserved = B_FALSE;
 604  602          }
 605  603  }
 606      -
 607      -
 608      -/*
 609      - * Compare the time here with the remote time on the server
 610      - * and report clock skew.
 611      - */
 612      -void
 613      -ndr_srvsvc_timecheck(char *server, char *domain)
 614      -{
 615      -        char                    hostname[MAXHOSTNAMELEN];
 616      -        struct timeval          dc_tv;
 617      -        struct tm               dc_tm;
 618      -        struct tm               *tm;
 619      -        time_t                  tnow;
 620      -        time_t                  tdiff;
 621      -        int                     priority;
 622      -
 623      -        if (srvsvc_net_remote_tod(server, domain, &dc_tv, &dc_tm) < 0) {
 624      -                syslog(LOG_DEBUG, "srvsvc_net_remote_tod failed");
 625      -                return;
 626      -        }
 627      -
 628      -        tnow = time(NULL);
 629      -
 630      -        if (tnow > dc_tv.tv_sec)
 631      -                tdiff = (tnow - dc_tv.tv_sec) / SECSPERMIN;
 632      -        else
 633      -                tdiff = (dc_tv.tv_sec - tnow) / SECSPERMIN;
 634      -
 635      -        if (tdiff != 0) {
 636      -                (void) strlcpy(hostname, "localhost", MAXHOSTNAMELEN);
 637      -                (void) gethostname(hostname, MAXHOSTNAMELEN);
 638      -
 639      -                priority = (tdiff > 2) ? LOG_NOTICE : LOG_DEBUG;
 640      -                syslog(priority, "DC [%s] clock skew detected: %u minutes",
 641      -                    server, tdiff);
 642      -
 643      -                tm = gmtime(&dc_tv.tv_sec);
 644      -                syslog(priority, "%-8s  UTC: %s", server, asctime(tm));
 645      -                tm = gmtime(&tnow);
 646      -                syslog(priority, "%-8s  UTC: %s", hostname, asctime(tm));
 647      -        }
 648      -}
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX