init.c revision 2b4a78020b9c38d1b95e2f3fefa6d6e4be382d1f
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Initialization routines
*/
#include "idmapd.h"
#include <signal.h>
#include <thread.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <rpcsvc/daemon_utils.h>
int
{
int rc = 0;
return (-1);
if ((rc = load_config()) < 0)
return (rc);
(void) setegid(DAEMON_GID);
(void) seteuid(DAEMON_UID);
if (init_dbs() < 0) {
rc = -1;
}
(void) seteuid(0);
(void) setegid(0);
return (rc);
}
void
{
fini_dbs();
}
int
{
int rc;
degrade_svc(0, "failed to initialize config");
return (-1);
}
if (rc < -1) {
/* Total failure */
degrade_svc(0, "fatal error while loading configuration");
return (rc);
}
if (rc != 0)
/* Partial failure */
"the configuration; check the logs");
if ((rc = idmap_cfg_start_updates()) < 0) {
/* Total failure */
degrade_svc(0, "could not start config updater");
return (rc);
}
return (0);
}
void
{
int i;
/*
* No GCs. Continue to use the previous AD config in case
* that's still good but auto-discovery had a transient failure.
* If that stops working we'll go into degraded mode anyways
* when it does.
*/
degrade_svc(0,
"Global Catalog servers not configured/discoverable");
return;
}
degrade_svc(0, "could not initialize AD context");
return;
}
if (idmap_add_ds(new,
degrade_svc(0, "could not initialize AD GC context");
return;
}
}
}
void
{
int i;
return;
}
} else {
}
} else {
}
}
int
{
int rc;
return (-1);
}
if (rc == 0)
return (-1);
}
return (0);
}