14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 /*
28 * Client NDR RPC interface.
29 */
30
31 #include <sys/types.h>
32 #include <sys/errno.h>
33 #include <sys/fcntl.h>
34 #include <sys/tzfile.h>
35 #include <time.h>
36 #include <strings.h>
37 #include <assert.h>
38 #include <errno.h>
39 #include <thread.h>
40 #include <unistd.h>
41 #include <syslog.h>
42 #include <synch.h>
43
44 #include <netsmb/smbfs_api.h>
45 #include <smbsrv/libsmb.h>
46 #include <smbsrv/libsmbns.h>
47 #include <smbsrv/libmlrpc.h>
48 #include <smbsrv/libmlsvc.h>
49 #include <smbsrv/ndl/srvsvc.ndl>
50 #include <libsmbrdr.h>
51 #include <mlsvc.h>
52
53 static int ndr_xa_init(ndr_client_t *, ndr_xa_t *);
54 static int ndr_xa_exchange(ndr_client_t *, ndr_xa_t *);
55 static int ndr_xa_read(ndr_client_t *, ndr_xa_t *);
56 static void ndr_xa_preserve(ndr_client_t *, ndr_xa_t *);
57 static void ndr_xa_destruct(ndr_client_t *, ndr_xa_t *);
58 static void ndr_xa_release(ndr_client_t *);
59
60
586
587 if (!clnt->heap_preserved) {
588 ndr_heap_destroy(mxa->heap);
589 mxa->heap = NULL;
590 clnt->heap = NULL;
591 }
592 }
593
594 /*
595 * Dispose of a preserved heap.
596 */
597 static void
598 ndr_xa_release(ndr_client_t *clnt)
599 {
600 if (clnt->heap_preserved) {
601 ndr_heap_destroy(clnt->heap);
602 clnt->heap = NULL;
603 clnt->heap_preserved = B_FALSE;
604 }
605 }
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 }
|
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 /*
28 * Client NDR RPC interface.
29 */
30
31 #include <sys/types.h>
32 #include <sys/errno.h>
33 #include <sys/fcntl.h>
34 #include <time.h>
35 #include <strings.h>
36 #include <assert.h>
37 #include <errno.h>
38 #include <thread.h>
39 #include <syslog.h>
40 #include <synch.h>
41
42 #include <netsmb/smbfs_api.h>
43 #include <smbsrv/libsmb.h>
44 #include <smbsrv/libsmbns.h>
45 #include <smbsrv/libmlrpc.h>
46 #include <smbsrv/libmlsvc.h>
47 #include <smbsrv/ndl/srvsvc.ndl>
48 #include <libsmbrdr.h>
49 #include <mlsvc.h>
50
51 static int ndr_xa_init(ndr_client_t *, ndr_xa_t *);
52 static int ndr_xa_exchange(ndr_client_t *, ndr_xa_t *);
53 static int ndr_xa_read(ndr_client_t *, ndr_xa_t *);
54 static void ndr_xa_preserve(ndr_client_t *, ndr_xa_t *);
55 static void ndr_xa_destruct(ndr_client_t *, ndr_xa_t *);
56 static void ndr_xa_release(ndr_client_t *);
57
58
584
585 if (!clnt->heap_preserved) {
586 ndr_heap_destroy(mxa->heap);
587 mxa->heap = NULL;
588 clnt->heap = NULL;
589 }
590 }
591
592 /*
593 * Dispose of a preserved heap.
594 */
595 static void
596 ndr_xa_release(ndr_client_t *clnt)
597 {
598 if (clnt->heap_preserved) {
599 ndr_heap_destroy(clnt->heap);
600 clnt->heap = NULL;
601 clnt->heap_preserved = B_FALSE;
602 }
603 }
|