15331Samw /* 25331Samw * CDDL HEADER START 35331Samw * 45331Samw * The contents of this file are subject to the terms of the 55331Samw * Common Development and Distribution License (the "License"). 65331Samw * You may not use this file except in compliance with the License. 75331Samw * 85331Samw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 95331Samw * or http://www.opensolaris.org/os/licensing. 105331Samw * See the License for the specific language governing permissions 115331Samw * and limitations under the License. 125331Samw * 135331Samw * When distributing Covered Code, include this CDDL HEADER in each 145331Samw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 155331Samw * If applicable, add the following below this CDDL HEADER, with the 165331Samw * fields enclosed by brackets "[]" replaced with your own identifying 175331Samw * information: Portions Copyright [yyyy] [name of copyright owner] 185331Samw * 195331Samw * CDDL HEADER END 205331Samw */ 215331Samw /* 225772Sas200622 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 235331Samw * Use is subject to license terms. 245331Samw */ 255331Samw 26*7348SJose.Borrego@Sun.COM #pragma ident "@(#)mlsvc_init.c 1.5 08/07/22 SMI" 275331Samw 285331Samw #include <unistd.h> 295772Sas200622 #include <pthread.h> 305331Samw #include <smbsrv/libmlsvc.h> 315331Samw 325331Samw void dssetup_initialize(void); 335331Samw void srvsvc_initialize(void); 345331Samw void wkssvc_initialize(void); 355331Samw void lsarpc_initialize(void); 365331Samw void logr_initialize(void); 375331Samw void netr_initialize(void); 385331Samw void samr_initialize(void); 395331Samw void svcctl_initialize(void); 405331Samw void winreg_initialize(void); 415772Sas200622 int srvsvc_gettime(unsigned long *); 425772Sas200622 435772Sas200622 static void *mlsvc_keepalive(void *); 445772Sas200622 455772Sas200622 static pthread_t mlsvc_keepalive_thr; 465772Sas200622 #define MLSVC_KEEPALIVE_INTERVAL (10 * 60) /* 10 minutes */ 475331Samw 485331Samw /* 495331Samw * All mlrpc initialization is invoked from here. 505331Samw * Returns 0 upon success. Otherwise, returns -1. 515331Samw */ 525331Samw int 535331Samw mlsvc_init(void) 545331Samw { 555772Sas200622 pthread_attr_t tattr; 565772Sas200622 int rc; 575772Sas200622 585331Samw srvsvc_initialize(); 595331Samw wkssvc_initialize(); 605331Samw lsarpc_initialize(); 615331Samw netr_initialize(); 625331Samw dssetup_initialize(); 635331Samw samr_initialize(); 645331Samw svcctl_initialize(); 655331Samw winreg_initialize(); 665331Samw logr_initialize(); 675331Samw 685772Sas200622 (void) pthread_attr_init(&tattr); 695772Sas200622 (void) pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED); 705772Sas200622 rc = pthread_create(&mlsvc_keepalive_thr, &tattr, 715772Sas200622 mlsvc_keepalive, 0); 725772Sas200622 (void) pthread_attr_destroy(&tattr); 735772Sas200622 return (rc); 745331Samw } 755772Sas200622 765772Sas200622 /*ARGSUSED*/ 775772Sas200622 static void * 785772Sas200622 mlsvc_keepalive(void *arg) 795772Sas200622 { 805772Sas200622 unsigned long t; 815772Sas200622 nt_domain_t *domain; 825772Sas200622 835772Sas200622 for (;;) { 845772Sas200622 (void) sleep(MLSVC_KEEPALIVE_INTERVAL); 855772Sas200622 865772Sas200622 if (smb_config_get_secmode() == SMB_SECMODE_DOMAIN) { 875772Sas200622 domain = nt_domain_lookupbytype(NT_DOMAIN_PRIMARY); 885772Sas200622 if (domain == NULL) 895772Sas200622 (void) lsa_query_primary_domain_info(); 90*7348SJose.Borrego@Sun.COM (void) srvsvc_gettime(&t); 915772Sas200622 } 925772Sas200622 } 935772Sas200622 945772Sas200622 /*NOTREACHED*/ 955772Sas200622 return (NULL); 965772Sas200622 } 97