/*
* 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
*/
/*
*/
/*
* 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/libntsvcs.h>
/*
* Information level for NetShareGetInfo.
*/
static void srvsvc_net_free(srvsvc_info_t *);
/*
* 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
{
}
static srvsvc_info_t *
{
return (NULL);
return (info);
}
static void
{
}
static void
{
case SMB_SVCENUM_TYPE_USER:
break;
case SMB_SVCENUM_TYPE_TREE:
break;
case SMB_SVCENUM_TYPE_FILE:
break;
case SMB_SVCENUM_TYPE_SHARE:
break;
}
}
/*
* This is a client side routine for NetShareGetInfo enumeration.
* Only level 1 request is supported.
*/
int
{
char *comment;
int opnum;
int rc;
int i;
return (-1);
return (-1);
}
if (rc != 0) {
return (-1);
}
return (-1);
}
comment = "";
else
SMB_SVCENUM_TYPE_SHARE)) != NULL) {
}
}
return (0);
}
/*
* 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;
return (-1);
return (-1);
return (-1);
}
return (-1);
}
case 0:
break;
case 1:
if (info1->shi1_comment)
break;
case 2:
if (info2->shi2_comment)
break;
default:
smb_tracef("srvsvc: unknown level");
break;
}
return (0);
}
/*
* This is a client side routine for NetFilesEnum.
* NetFilesEnum requires administrator rights.
* Level 2 and 3 requests are supported.
*
* The basepath parameter specifies a qualifier for the returned information.
* If this parameter is not NULL, the server MUST enumerate only resources that
* have basepath as a prefix.
*
* If username parameter is specified, the server MUST limit the files returned
* to those that were opened by a session whose user name matches username.
*/
int
{
if (rc != 0)
return (-1);
return (-1);
}
switch (level) {
case 2:
break;
case 3:
break;
default:
return (-1);
}
return (-1);
}
switch (level) {
case 2:
for (i = 0; i < sl->sl_entriesread &&
i < sl->sl_totalentries; ++i) {
SMB_SVCENUM_TYPE_FILE)) != NULL) {
}
}
break;
case 3:
for (i = 0; i < sl->sl_entriesread &&
i < sl->sl_totalentries; ++i) {
break;
SMB_SVCENUM_TYPE_FILE)) != NULL) {
sf->fi_username =
}
}
break;
default:
rc = -1;
break;
}
return (rc);
}
/*
* This is a client side routine for NetConnectEnum.
* NetConnectEnum requires administrator rights.
* Level 0 and 1 requests are supported.
*
* The qualifier parameter specifies a share name or computer name for
* connections of interest to the client. Qualifiers that begin with \\ are
* considered server names and anything else is considered a share name.
* Share names MUST NOT begin with \\.
*
* The qualifier parameter must not be NULL.
*/
int
{
return (-1);
if (rc != 0)
return (-1);
return (-1);
}
switch (level) {
case 0:
break;
case 1:
break;
default:
return (-1);
}
return (-1);
}
switch (level) {
case 0:
for (i = 0; i < sl->sl_entriesread &&
i < sl->sl_totalentries; ++i) {
SMB_SVCENUM_TYPE_TREE)) != NULL) {
}
}
break;
case 1:
for (i = 0; i < sl->sl_entriesread &&
i < sl->sl_totalentries; ++i) {
break;
SMB_SVCENUM_TYPE_TREE)) != NULL) {
sc->ci_username =
}
}
break;
default:
rc = -1;
break;
}
return (rc);
}
/*
* This is a client side routine for NetSessionEnum.
* NetSessionEnum requires administrator rights.
* Only level 1 request is supported.
*
* The clientname parameter specifies a qualifier for the returned information.
* If a clientname is specified (i.e. it is not a NULL (zero-length) string),
* the client computer name MUST match the ClientName for the session to be
* returned. If a clientname is specified, it MUST start with "\\".
*
* The username parameter specifies a qualifier for the returned information.
* If a username is specified (that is, not a NULL (zero-length) string), the
* user name MUST match the username parameter for the session to be returned.
*/
int
{
if (rc != 0)
return (-1);
return (-1);
}
if (clientname != NULL)
return (-1);
}
SMB_SVCENUM_TYPE_USER)) != NULL) {
ss->ui_account =
ss->ui_workstation =
}
}
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);
}
/*
* NetRemoteTOD to get the current GMT time from a Windows NT server.
*/
int
srvsvc_gettime(unsigned long *t)
{
return (-1);
return (0);
}
/*
* Wrapper function for srvsvc_net_remote_tod() that gets the time and
* date from the selected DC. The time information is returned in
* the timeval and tm.
*
* Upon detection of a DC failure, reports the failed DC to DC failover
* service and retries with a newly selected DC after DC failover completes.
*/
static int
{
int rc;
int i = 0;
do {
if (!smb_domain_getinfo(&di))
return (-1);
errno = 0;
tm);
if (rc == 0)
break;
if (!ntsvcs_srv_down(errno))
break;
} while (i++ < SMB_MAX_DC_FAILURES);
return (rc);
}
/*
* 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;
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
{
}
void
{
return;
}
}
void
{
if (smb_domain_getinfo(&di)) {
}
smb_tracef("NetServerGetInfo: %s %s (%d.%d) id=%d type=0x%08x",
}
srvsvc_info_level, &shinfo) == 0) {
smb_tracef("NetShareGetInfo: %s %s %s (type=%d) %s",
}
}