/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* lib/krb5/os/changepw.c
*
* Copyright 1990,1999,2001,2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*/
/*
* krb5_set_password - Implements set password per RFC 3244
* Added by Paul W. Nelson, Thursby Software Systems, Inc.
* Modified by Todd Stecher, Isilon Systems, to use krb1.4 socket infrastructure
*/
#include "fake-addrinfo.h"
#include "k5-int.h"
#include "os-proto.h"
#include "cm.h"
/* Solaris Kerberos: tweaked so auth_con.h could be found */
#include "auth_con.h"
#include <stdio.h>
#include <errno.h>
#ifndef GETSOCKNAME_ARG3_TYPE
#define GETSOCKNAME_ARG3_TYPE int
#endif
struct sendto_callback_context {
char *newpw;
};
/*
* Wrapper function for the two backends
*/
/* Solaris Kerberos: removed static because other funcs are calling this */
{
if (!code) {
/* Success with admin_server but now we need to change the
port number to use DEFAULT_KPASSWD_PORT and the socktype. */
size_t i;
if (sockType != SOCK_STREAM)
a->ai_socktype = sockType;
}
}
}
return (code);
}
/**
* This routine is used for a callback in sendto_kdc.c code. Simply
* put, we need the client addr to build the krb_priv portion of the
* password request.
*/
static void
{
}
static int
void *callback_context,
{
/*
* We need the local addr from the connection socket
*/
addrlen = sizeof(local_addr);
code = SOCKET_ERRNO;
goto cleanup;
}
/* some brain-dead OS's don't return useful information from
* the getsockname call. Namely, windows and solaris. */
} else {
if (code)
goto cleanup;
goto cleanup;
}
}
/*
* TBD: Does this tamper w/ the auth context in such a way
* to break us? Yes - provide 1 per conn-state / host...
*/
&local_kaddr, NULL)))
goto cleanup;
if (ctx->set_password_for)
&output);
else
&output);
if (code)
goto cleanup;
return code;
}
/*
** The logic for setting and changing a password is mostly the same
** change_set_password handles both cases
** if set_password_for is NULL, then a password change is performed,
** otherwise, the password is set for the principal indicated in set_password_for
*/
static krb5_error_code
char *newpw,
int *result_code,
{
char *code_string;
int local_result_code;
goto cleanup;
NULL,
&callback_ctx.ap_req)))
goto cleanup;
do {
break;
addrlen = sizeof(remote_addr);
NULL,
&al,
&chpw_rep,
NULL,
NULL,
ss2sa(&remote_addr),
&addrlen,
NULL,
NULL,
))) {
/*
* Here we may want to switch to TCP on some errors.
* right?
*/
break;
}
} else {
break;
}
NULL,
&remote_kaddr)))
break;
if (set_password_for)
&chpw_rep,
else
&chpw_rep,
if (code) {
useTcp = 1;
continue;
}
break;
}
if (result_code)
if (result_code_string) {
if (set_password_for)
(const char **)&code_string);
else
&code_string);
if(code)
goto cleanup;
goto cleanup;
}
}
useTcp = 1;
} else {
break;
}
} while (TRUE);
return(code);
}
char *newpw,
int *result_code,
{
}
/*
* krb5_set_password - Implements set password per RFC 3244
*
*/
char *newpw,
int *result_code,
)
{
}
char *newpw,
int *result_code,
)
{
/*
** get the proper creds for use with krb5_set_password -
*/
/*
** first get the principal for the password service -
*/
if (!code) {
if (!code) {
if (!code) {
}
}
}
return code;
}