* libkdb_ldap/ldap_realm.c (ignore_duplicates, compare): Unused functions deleted.
(krb5_ldap_modify_realm, krb5_ldap_read_realm_params): Conditionalize declarations of
automatic variables that are only used for eDirectory.
* libkdb_ldap/ldap_service_stash.c (tohex): Use one sprintf call instead of two.
(dec_password): Use an unsigned type to fetch values with %x.
* libkdb_ldap/ldap_realm.h (ldap_filter_correct): Declare.
* libkdb_dlap/ldap_misc.c (my_strndup): Only define if HAVE_LDAP_STR2DN.
(populate_krb5_db_entry): Remove unused automatic variable.
* ldap_util/kdb5_ldap_util.c (cmd_table): Fix typo in preprocessing conditional.
* ldap_util/kdb5_ldap_realm.c (get_ticket_policy): Declarations first, then code.
* ldap_util/kdb5_ldap_services.c (kdb5_ldap_stash_service_password): On error, increment
exit_status; don't return a value.
* ldap_util/kdb5_ldap_services.h (kdb5_ldap_stash_service_password): Update decl.
ticket: new
target_version: 1.6
tags: pullup
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18813
dc483132-0cff-0310-8789-
dd5450dbe970
{
time_t date;
time_t now;
- time(&now);
int mask = 0;
krb5_error_code retval = 0;
krb5_boolean no_msg = FALSE;
krb5_boolean print_usage = FALSE;
char *me = argv[0];
+
+ time(&now);
if (!strcmp(argv[*i], "-maxtktlife")) {
if (++(*i) > argc-1)
goto err_usage;
* Convert the user supplied password into hexadecimal and stash it. Only a
* little more secure than storing plain password in the file ...
*/
-int
+void
kdb5_ldap_stash_service_password(argc, argv)
int argc;
char **argv;
usage();
/* db_usage(STASH_SRV_PW); */
- return ret;
+ if (ret)
+ exit_status++;
}
#endif /* #ifdef HAVE_EDIRECTORY */
extern void kdb5_ldap_set_service_certificate(int argc, char **argv);
extern void print_service_params(krb5_ldap_service_params *lserparams, int mask);
extern krb5_error_code convert_realm_name2dn_list(char **list, const char *krbcontainer_loc);
-extern int kdb5_ldap_stash_service_password(int argc, char **argv);
+extern void kdb5_ldap_stash_service_password(int argc, char **argv);
{"destroy_service", kdb5_ldap_destroy_service, 1},
{"list_service",kdb5_ldap_list_services,1},
{"setsrvpw", kdb5_ldap_set_service_password, 0},
-#else {"stashsrvpw", kdb5_ldap_stash_service_password, 0},
+#else
+ {"stashsrvpw", kdb5_ldap_stash_service_password, 0},
#endif
{"create_policy", kdb5_ldap_create_policy, 1},
{"modify_policy", kdb5_ldap_modify_policy, 1},
But all the world's not Linux. */
#undef strndup
#define strndup my_strndup
+#ifdef HAVE_LDAP_STR2DN
static char *my_strndup (const char *input, size_t limit)
{
size_t len = strlen(input);
} else
return strdup(input);
}
+#endif
/* Get integer or string values from the config section, falling back
to the default section, then to hard-coded values. */
*/
krb5_error_code
populate_krb5_db_entry (krb5_context context,
- krb5_ldap_context *ldap_context,
- LDAP *ld,
- LDAPMessage *ent,
- krb5_const_principal princ,
- krb5_db_entry *entry)
+ krb5_ldap_context *ldap_context,
+ LDAP *ld,
+ LDAPMessage *ent,
+ krb5_const_principal princ,
+ krb5_db_entry *entry)
{
krb5_error_code st = 0;
unsigned int mask = 0;
struct berval **bvalues = NULL;
krb5_tl_data userinfo_tl_data = {0};
char **link_references = NULL;
- krb5_ui_2 entry_len;
char *DN = NULL;
if (princ == NULL) {
char *krbContainerRefclass[] = { "krbContainerRefAux", NULL};
-
-static void
-ignore_duplicates(int_list)
- int *int_list;
-{
- int i=0, j=0, scount=0;
-
- for (i=0; int_list[i] != END_OF_LIST; scount=i++)
- ;
-
- for (i=0; i <= scount; ++i) {
- if (i > 0 && int_list[i] == int_list[i-1]) {
- for (j=i; j<=scount; ++j)
- int_list[j-1] = int_list[j];
- int_list[scount] = END_OF_LIST;
- --scount;
- --i;
- continue;
- }
- }
-}
-
/*
* list realms from eDirectory
*/
return st;
}
-static int compare (const void *i, const void *j) {
- if (*(const krb5_int32 *)i > *(const krb5_int32 *)j)
- return 1;
-
- if (*(const krb5_int32 *)i < *(const krb5_int32 *)j)
- return -1;
-
- return 0;
-}
-
/*
* Modify the realm attributes in the Directory.
char errbuf[1024];
#endif
LDAPMod **mods = NULL;
- int i=0, oldmask=0, objectmask=0,k=0;
+#ifdef HAVE_EDIRECTORY
+ int i=0;
+#endif
+ int oldmask=0, objectmask=0,k=0;
kdb5_dal_handle *dal_handle=NULL;
krb5_ldap_context *ldap_context=NULL;
krb5_ldap_server_handle *ldap_server_handle=NULL;
int *mask;
{
char **values=NULL, *krbcontDN=NULL /*, *curr=NULL */;
- unsigned int i=0, /* masklen=4, */ count=0;
+#ifdef HAVE_EDIRECTORY
+ unsigned int count=0;
+#endif
krb5_error_code st=0, tempst=0;
LDAP *ld=NULL;
LDAPMessage *result=NULL,*ent=NULL;
krb5_error_code
krb5_ldap_delete_realm_1(krb5_context, char *, char **);
+char *
+ldap_filter_correct(unsigned char *, unsigned int);
+
#endif
krb5_data in;
krb5_data *ret;
{
- int i=0, j=0, err = 0;
+ int i=0, err = 0;
ret->length = 0;
ret->data = NULL;
- ret->data = (unsigned char *)malloc((unsigned int)in.length * 2 + 1 /*Null termination */);
+ ret->data = malloc((unsigned int)in.length * 2 + 1 /*Null termination */);
if (ret->data == NULL) {
err = ENOMEM;
goto cleanup;
ret->length = in.length * 2;
ret->data[ret->length] = 0;
- for (i = 0, j = 0; i < in.length; i++, j += 2) {
- sprintf((char *)ret->data + j, "%x", in.data[i] >> 4);
- sprintf((char *)ret->data + j + 1, "%x", in.data[i] & 0xf);
- }
+ for (i = 0; i < in.length; i++)
+ sprintf(ret->data + 2 * i, "%02x", in.data[i] & 0xff);
cleanup:
ret->len = (pwd.len - strlen("{HEX}")) / 2;
ret->value[ret->len] = '\0';
for (i = strlen("{HEX}"), j = 0; i < pwd.len; i += 2, j++) {
- int k;
+ unsigned int k;
/* Check if it is a hexadecimal number */
if (isxdigit(pwd.value[i]) == 0 || isxdigit(pwd.value[i + 1]) == 0) {
err = ERR_PWD_NOT_HEX;