/*
* 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 2013 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Test program for opening an SMB connection directly.
*/
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <libintl.h>
extern char *optarg;
extern int smb_iod_connect(struct smb_ctx *);
static char *server;
static void
tconn_usage(void)
{
printf("usage: tconn [-d domain][-u user][-p passwd] server\n");
exit(1);
}
int
{
switch (c) {
case 'v':
smb_debug = 1;
smb_verbose = 1;
break;
case 'd':
break;
case 'u':
break;
case 'p':
break;
case 's':
break;
case '?':
tconn_usage();
break;
}
}
tconn_usage();
argv[0]);
tconn_usage();
}
/*
* This section is intended to demonstrate how an
* RPC client library might use this interface.
*/
if (error) {
goto out;
}
/*
* Set server, share, domain, user
* (in the ctx handle).
*/
if (dom)
if (usr)
if (pw)
/*
* Hackish option to override the Authentication Type flags.
* Sorry about exposing the flag values here, but this is
* really a programmer's test tool. See smbfs_api.h for
* the SMB_AT_... flag values.
*/
tconn_usage();
}
}
/*
* Resolve the server address,
* setup derived defaults.
*/
if (error) {
goto out;
}
goto out;
}
/*
* If this code were in smbutil or mount_smbfs, it would
* get system and $HOME/.nsmbrc settings here, like this:
*/
if (error) {
goto out;
}
printf("Yea, we connected!\n");
out:
return ((error) ? 1 : 0);
}