/*
 *  Unix SMB/CIFS implementation.
 *  Join Support (cmdline + netapi)
 *  Copyright (C) Guenther Deschner 2007-2008
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, see .
 */
#include 
#include 
#include 
#include 
#include 
#include 
char *get_string_param(const char *param)
{
	char *p;
	p = strchr(param, '=');
	if (!p) {
		return NULL;
	}
	return (p+1);
}
int main(int argc, char **argv)
{
	NET_API_STATUS status;
	const char *server_name = NULL;
	const char *domain_name = NULL;
	const char *account_ou = NULL;
	const char *Account = NULL;
	const char *password = NULL;
	uint32_t join_flags = 3;
	struct libnetapi_ctx *ctx = NULL;
	int i;
	status = libnetapi_init(&ctx);
	if (status != 0) {
		return status;
	}
	if (argc < 2) {
		printf("usage: netdomjoin\n");
		printf("\t[hostname] [domain=DOMAIN]  "
		       "  "
		       "  "
		       "\n");
		return 0;
	}
	if (argc > 2) {
		server_name = argv[1];
	}
	for (i=0; i