/*
* 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 2015 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Server Service (srvsvc) client side RPC library interface. The
* srvsvc interface allows a client to query a server for information
* on shares, sessions, connections and files on the server. Some
* functions are available via anonymous IPC while others require
* administrator privilege. Also, some functions return NT status
* values while others return Win32 errors codes.
*/
#include <stdio.h>
#include <time.h>
#include <strings.h>
#include <smbsrv/libmlsvc.h>
/*
* Information level for NetShareGetInfo.
*/
/*
* Bind to the the SRVSVC.
*
* If username argument is NULL, an anonymous connection will be established.
* Otherwise, an authenticated connection will be established.
*/
static int
{
if (!smb_domain_getinfo(&di))
return (-1);
}
return (-1);
return (0);
}
/*
* Unbind the SRVSVC connection.
*/
static void
{
}
/*
* This is a client side routine for NetShareGetInfo.
* Levels 0 and 1 work with an anonymous connection but
* level 2 requires administrator access.
*/
int
{
int rc;
int opnum;
int len;
return (-1);
if (srvsvc_info_level == 2)
return (-1);
return (-1);
}
return (-1);
}
case 0:
break;
case 1:
if (info1->shi1_comment)
smb_tracef("srvsvc shi1_comment=%s",
break;
case 2:
if (info2->shi2_comment)
smb_tracef("srvsvc shi2_comment=%s",
if (info2->shi2_passwd)
break;
default:
smb_tracef("srvsvc: unknown level");
break;
}
return (0);
}
/*
* This is a client side routine for NetSessionEnum.
* NetSessionEnum requires administrator rights.
*/
int
{
int rc;
int opnum;
int len;
return (-1);
if (rc != 0)
return (-1);
return (-1);
}
infonres.entriesread = 0;
arg.resume_handle = 0;
return (-1);
}
/* Only the first session info is dereferenced. */
return (0);
}
/*
* This is a client side routine for NetConnectEnum.
* NetConnectEnum requires administrator rights.
* Level 0 and level 1 requests are supported.
*/
int
{
int rc;
int opnum;
int len;
return (-1);
if (rc != 0)
return (-1);
return (-1);
}
switch (level) {
case 0:
info0.entries_read = 0;
break;
case 1:
info1.entries_read = 0;
break;
default:
return (-1);
}
arg.resume_handle = 0;
return (-1);
}
switch (level) {
case 0:
smb_tracef("srvsvc coni0_id=%x",
}
break;
case 1:
smb_tracef("srvsvc coni_uname=%s",
smb_tracef("srvsvc coni1_netname=%s",
smb_tracef("srvsvc coni1_nopens=%u",
smb_tracef("srvsvc coni1_num_users=%u",
}
break;
default:
smb_tracef("srvsvc: unknown level");
break;
}
return (0);
}
/*
* Windows 95+ and Windows NT4.0 both report the version as 4.0.
* Windows 2000+ reports the version as 5.x.
*/
int
{
return (-1);
return (-1);
return (-1);
}
if (sv101->sv101_name)
if (sv101->sv101_comment)
return (0);
}
/*
* Synchronize the local system clock with the domain controller.
*/
void
srvsvc_timesync(void)
{
if (!smb_domain_getinfo(&di))
return;
return;
if (settimeofday(&tv, 0))
smb_tracef("unable to set system time");
}
/*
* NetRemoteTOD to get the current GMT time from a Windows NT server.
*/
int
srvsvc_gettime(unsigned long *t)
{
if (!smb_domain_getinfo(&di))
return (-1);
return (-1);
return (0);
}
/*
* This is a client side routine for NetRemoteTOD, which gets the time
* and date from a remote system. The time information is returned in
* the timeval and tm.
*
* typedef struct _TIME_OF_DAY_INFO {
* DWORD tod_elapsedt; // seconds since 00:00:00 January 1 1970 GMT
* DWORD tod_msecs; // arbitrary milliseconds (since reset)
* DWORD tod_hours; // current hour [0-23]
* DWORD tod_mins; // current minute [0-59]
* DWORD tod_secs; // current second [0-59]
* DWORD tod_hunds; // current hundredth (0.01) second [0-99]
* LONG tod_timezone; // time zone of the server
* DWORD tod_tinterval; // clock tick time interval
* DWORD tod_day; // day of the month [1-31]
* DWORD tod_month; // month of the year [1-12]
* DWORD tod_year; // current year
* DWORD tod_weekday; // day of the week since sunday [0-6]
* } TIME_OF_DAY_INFO;
*
* The time zone of the server is calculated in minutes from Greenwich
* Mean Time (GMT). For time zones west of Greenwich, the value is
* positive; for time zones east of Greenwich, the value is negative.
* A value of -1 indicates that the time zone is undefined.
*
* The clock tick value represents a resolution of one ten-thousandth
* (0.0001) second.
*/
int
{
int rc;
int opnum;
int len;
if (rc != 0)
return (-1);
return (-1);
}
return (-1);
}
/*
* We're assigning milliseconds to microseconds
* here but the value's not really relevant.
*/
if (tv) {
}
if (tm) {
}
return (0);
}
void
{
if (smb_domain_getinfo(&di)) {
}
smb_tracef("NetServerGetInfo: %s %s (%d.%d) id=%d type=0x%08x",
}
#if 0
/*
* The NetSessionEnum server-side definition was updated.
* Disabled until the client-side has been updated.
*/
#endif
}