smb_info.c revision 55bf511df53aad0fdb7eb3fa349f0308cc05234c
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdarg.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include <synch.h>
#include <syslog.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <netdb.h>
static smb_ntdomain_t smbpdc_cache;
static mutex_t smbpdc_mtx;
extern int getdomainname(char *, int);
{
return (mode);
}
/*
* smb_purge_domain_info
*
* Clean out the environment in preparation for joining a domain.
* This ensures that we don't have any old information lying around.
*/
void
smb_purge_domain_info(void)
{
(void) smb_config_set(SMB_CI_DOMAIN_NAME, 0);
(void) smb_config_set(SMB_CI_DOMAIN_SID, 0);
(void) smb_config_set(SMB_CI_DOMAIN_MEMB, 0);
}
int
smb_is_domain_member(void)
{
int is_memb;
return (is_memb);
}
smb_get_fg_flag(void)
{
return (run_fg);
}
void
smb_set_domain_member(int set)
{
char *member;
}
/*
* smb_set_machine_pwd
*
* Returns 0 upon success. Otherwise, returns 1.
*/
int
smb_set_machine_pwd(char *pwd)
{
int rc;
return (rc);
}
/*
* smb_getdomaininfo
*
* Returns a pointer to the cached domain data. The caller can specify
* whether or not he is prepared to wait if the cache is not yet valid
* and for how long. The specified timeout is in seconds.
*/
{
int err;
if (timeout != 0) {
(void) mutex_lock(&smbpdc_mtx);
while (smbpdc_cache.ipaddr == 0) {
break;
}
(void) mutex_unlock(&smbpdc_mtx);
}
if (smbpdc_cache.ipaddr != 0)
return (&smbpdc_cache);
else
return (0);
}
void
{
char ipstr[16];
sizeof (ipstr));
}
/*
* smb_setdomaininfo
*
* Set the information for the specified domain. If the information is
* non-null, the notification event is raised to wakeup any threads
* blocking on the cache.
*/
void
{
char *p;
/*
* Remove DNS domain name extension
* to avoid confusing NetBIOS.
*/
*p = '\0';
*p = '\0';
(void) mutex_lock(&smbpdc_mtx);
(void) cond_broadcast(&smbpdc_cv);
(void) mutex_unlock(&smbpdc_mtx);
}
}
void
{
if ((kcfg->skc_keepalive != 0) &&
sizeof (kcfg->skc_resource_domain));
sizeof (kcfg->skc_system_comment));
}
/*
* Get the current system NetBIOS name. The hostname is truncated at
* the first `.` or 15 bytes, whichever occurs first, and converted
* to uppercase (by smb_gethostname). Text that appears after the
* first '.' is considered to be part of the NetBIOS scope.
*
* Returns 0 on success, otherwise -1 to indicate an error.
*/
int
{
return (-1);
if (buflen >= NETBIOS_NAME_SZ)
return (0);
}
/*
* Get the current system node name. The returned name is guaranteed
* to be null-terminated (gethostname may not null terminate the name).
* If the hostname has been fully-qualified for some reason, the domain
* part will be removed. If the caller would like the name in upper
* case, it is folded to uppercase.
*
* If gethostname fails, the returned buffer will contain an empty
* string.
*/
int
{
char *p;
return (-1);
*buf = '\0';
return (-1);
}
*p = '\0';
if (upcase)
(void) utf8_strupr(buf);
return (0);
}
/*
* The ADS domain is often the same as the DNS domain but they can be
* different - one might be a sub-domain of the other.
*
* If an ADS domain name has been configured, return it. Otherwise,
* return the DNS domain name.
*
* If getdomainname fails, the returned buffer will contain an empty
* string.
*/
int
{
char *domain;
return (-1);
return (0);
}
*buf = '\0';
return (-1);
}
return (0);
}
/*
* Obtain the fully-qualified name for this machine. If the
* hostname is fully-qualified, accept it. Otherwise, try to
* find an appropriate domain name to append to the hostname.
*/
int
{
char hostname[MAXHOSTNAMELEN];
char domain[MAXHOSTNAMELEN];
hostname[0] = '\0';
domain[0] = '\0';
return (-1);
return (-1);
if (hostname[0] == '\0')
return (-1);
if (domain[0] == '\0') {
return (0);
}
return (0);
}
/*
* Temporary fbt for dtrace until user space sdt enabled.
*/
void
smb_tracef(const char *fmt, ...)
{
char buf[128];
}
/*
* Temporary fbt for dtrace until user space sdt enabled.
*/
void
smb_trace(const char *s)
{
}