/*
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 2004-2005, Novell, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* * The copyright holder's name is not used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Create / Delete / Modify / View / List policy objects.
*/
#include <stdio.h>
#include <time.h>
#include <k5-int.h>
#include <libintl.h>
#include <locale.h>
#include "kdb5_ldap_util.h"
#include "kdb5_ldap_list.h"
#include "ldap_tkt_policy.h"
extern char *yes;
extern kadm5_config_params global_params;
/* This operation is being performed in the context of a realm. So,
* initialize the realm */
int mask = 0;
if (!ldap_context) {
goto cleanup;
}
&(ldap_context->krbcontainer));
if (retval != 0) {
/* Solaris Kerberos */
goto cleanup;
}
}
&(ldap_context->lrparams),
&mask);
if (retval != 0) {
goto cleanup;
}
}
return retval;
}
/*
* This function will create a ticket policy object with the
* specified attributes.
*/
void
int argc;
char *argv[];
{
/* Solaris Kerberos */
int mask = 0;
int i = 0;
/* Check for number of arguments */
goto err_usage;
}
/* Allocate memory for policy parameters structure */
if (policyparams == NULL) {
goto cleanup;
}
/* Get current time */
/* Parse all arguments */
for (i = 1; i < argc; i++) {
if (++i > argc - 1)
goto err_usage;
goto err_nomsg;
}
if (++i > argc - 1)
goto err_usage;
goto err_nomsg;
}
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
} else { /* Any other argument must be policy DN */
/* First check if policy DN is already provided --
if so, there's a usage error */
goto err_usage;
/* If not present already, fill up policy DN */
goto err_nomsg;
}
}
}
/* policy DN is a mandatory argument. If not provided, print usage */
goto err_usage;
goto err_nomsg;
}
/* Create object with all attributes provided */
goto cleanup;
goto cleanup;
print_usage = TRUE;
/* Clean-up structure */
if (print_usage)
if (retval) {
if (!no_msg)
exit_status++;
}
return;
}
/*
* This function will destroy the specified ticket policy
* object interactively, unless forced through an option.
*/
void
int argc;
char *argv[];
{
/* Solaris Kerberos */
unsigned int mask = 0;
int force = 0;
int i = 0;
goto err_usage;
}
for (i = 1; i < argc; i++) {
force++;
} else { /* Any other argument must be policy DN */
/* First check if policy DN is already provided --
if so, there's a usage error */
goto err_usage;
/* If not present already, fill up policy DN */
goto err_nomsg;
}
}
}
goto err_usage;
if (!force) {
goto cleanup;
}
exit_status++;
goto cleanup;
}
}
goto err_nomsg;
goto cleanup;
goto cleanup;
goto cleanup;
print_usage = TRUE;
/* Clean-up structure */
if (policy) {
}
if (print_usage) {
}
if (retval) {
if (!no_msg)
exit_status++;
}
return;
}
/*
* This function will modify the attributes of a given ticket
* policy object.
*/
void
int argc;
char *argv[];
{
/* Solaris Kerberos */
int i = 0;
/* Check for number of arguments -- minimum is 3
since atleast one parameter should be given in
addition to 'modify_policy' and policy DN */
goto err_usage;
}
/* Parse all arguments, only to pick up policy DN (Pass 1) */
for (i = 1; i < argc; i++) {
/* Skip arguments next to 'maxtktlife'
and 'maxrenewlife' arguments */
++i;
++i;
}
/* Do nothing for ticket flag arguments */
} else { /* Any other argument must be policy DN */
/* First check if policy DN is already provided --
if so, there's a usage error */
goto err_usage;
/* If not present already, fill up policy DN */
goto err_nomsg;
}
}
}
goto err_usage;
goto cleanup;
if (retval) {
goto err_nomsg;
}
/* Get current time */
/* Parse all arguments, but skip policy DN (Pass 2) */
for (i = 1; i < argc; i++) {
if (++i > argc - 1)
goto err_usage;
goto err_nomsg;
}
if (++i > argc - 1)
goto err_usage;
goto err_nomsg;
}
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
if (*(argv[i]) == '+')
else if (*(argv[i]) == '-')
else
goto err_usage;
} else {
/* Any other argument must be policy DN
-- skip it */
}
}
/* Modify attributes of object */
goto cleanup;
goto cleanup;
print_usage = TRUE;
/* Clean-up structure */
if (policy)
if (print_usage)
if (retval) {
if (!no_msg)
exit_status++;
}
return;
}
/*
* This function will display information about the given policy object,
* fetching the information from the LDAP Server.
*/
void
int argc;
char *argv[];
{
/* Solaris Kerberos */
unsigned int mask = 0;
if (argc != 2) {
goto err_usage;
}
exit_status++;
goto cleanup;
}
goto cleanup;
exit_status++;
goto cleanup;
}
goto cleanup;
print_usage = TRUE;
if (policy)
if (print_usage) {
}
return;
}
/*
* This function will print the policy object information to the
* standard output.
*/
static void
int mask;
{
/* Print the policy DN */
/* Print max. ticket life and max. renewable life, if present */
if (mask & LDAP_POLICY_MAXTKTLIFE)
if (mask & LDAP_POLICY_MAXRENEWLIFE)
/* Service flags are printed */
if (mask & LDAP_POLICY_TKTFLAGS) {
if (ticketflags & KRB5_KDB_DISALLOW_SVR)
}
printf("\n");
return;
}
/*
* This function will list the DNs of policy objects under a specific
* sub-tree (entire tree by default)
*/
int argc;
char *argv[];
{
/* Solaris Kerberos */
/* Check for number of arguments */
goto err_usage;
}
goto cleanup;
goto cleanup;
}
goto cleanup;
print_usage = TRUE;
}
if (basedn)
if (print_usage) {
}
if (retval) {
exit_status++;
}
return;
}
/* Reproduced from kadmin.c, instead of linking
the entire kadmin.o */
{
if (duration < 0) {
duration *= -1;
neg = 1;
} else
neg = 0;
duration %= 3600;
duration %= 60;
return out;
}