Commit Graph

32 Commits

Author SHA1 Message Date
Jeffrey Altman
dba026b5ef Introduce and apply krb5_storage_from_socket
On Windows a file descriptor is an int value allocated by the
local module instance of the C Run Time Library.  A socket handle is a
SOCKET value allocated by a Winsock Provider for the requested family and
protocol.   These two values cannot be mixed and there is no mechanism for
converting between the two.   The _get_osfhandle() and _open_osfhandle()
functions can work with a standard HANDLE (file, pipe, etc) but cannot be
used for a SOCKET.

The Heimdal krb5_storage_from_fd() routine counted on the osf conversion
functions working on SOCKET values.  Since they do not any attempt to call
krb5_storage_from_fd() on a socket resulted in an assertion being thrown
by the C RTL.

Another problem is SOCKET value truncation when storing a 64-bit value
into a 32-bit int.

To address these problems a new krb5_storage_from_socket() routine is
introduced.  This routine setups a krb5_storage that stores a socket value
as a rk_socket_t and provides a set of helper routines that always use
network ready functions.

The krb5_storage_from_fd() routines no longer use net_read() and
net_write() but provide helpers that follow their logic so that pipes can
be processed.

All call sites that allocate a socket now store the socket as rk_socket_t
and call krb5_storage_from_socket().

All locations that previously called the bare close() on a socket value
now call rk_closesocket().

Change-Id: I045f775b2a5dbf5cf803751409490bc27fffe597
2014-02-04 23:20:08 -05:00
Roland C. Dowdeswell
932c4c1859 We use a struct defined in sys/un.h. 2012-02-25 17:19:44 +00:00
Roland C. Dowdeswell
12b24ad876 Add a server side implementation of kadm5_create_principal_3(). 2012-02-24 18:56:30 +00:00
Roland C. Dowdeswell
af011f57fc Provide server side kadm5_chpass_principal_3() with ks_tuple implementation.
We enable kadm5_chpass_principal_3() in the server side of the
library.  The client kadm5 library calls will still return the
error KAMD5_KS_TUPLE_NO_SUPP.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2011-11-29 14:47:37 -06:00
Nicolas Williams
dfc7ec92fa Make kadm5_lock() and unlock work, and add kadmin commands for them.
The libkadm5 functions hdb_open() and close around all HDB ops.  This
meant the previous implementation of kadm5_lock() and unlock would
always result in a core dump.  Now we hdb_open() for write in
kadm5_lock() and hdb_close() in kadm5_unlock(), with all kadm5_s_*()
functions now not opening nor closing the HDB when the server context
keep_open flag is set.

Also, there's now kadmin(8) lock and unlock commands.  These are there
primarily as a way to test the kadm5_lock()/unlock() operations, but
MIT's kadmin.local also has lock/unlock commands, and these can be
useful for scripting (though they require much care).
2011-07-22 21:07:48 -05:00
Nicolas Williams
0d90e0c4d0 Complete --keepold support and fix crasher in kadmin cpw -r --keepold. 2011-07-22 16:07:06 -05:00
Nicolas Williams
e16360e2db Add --keepold option to cpw. 2011-07-22 16:07:05 -05:00
Nicolas Williams
58d72035f1 Added kadm5_lock() and unlock. 2011-07-22 16:04:52 -05:00
Nicolas Williams
6e04b05e9d Initial support for kadm5_randkey_principal_3(), needed by krb5_admin.
NOT TESTED YET.
2011-07-22 16:04:52 -05:00
Love Hornquist Astrand
f1c0c1bba3 prefix SOCKET symbols with rk_ 2009-11-25 05:29:18 +01:00
Asanka Herath
d84119813e No AF_UNIX on Windows and no SIGPIPE and SIGXCPU 2009-11-24 10:12:44 -08:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
284d45bbbc use hdb_db_dir() and hdb_default_db()
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22211 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-12-07 19:27:27 +00:00
Love Hörnquist Åstrand
5118c90498 Rename u_intXX_t to uintXX_t
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17450 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-05-05 11:11:43 +00:00
Love Hörnquist Åstrand
ee050659b1 Constify password
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16044 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-09-08 11:30:53 +00:00
Love Hörnquist Åstrand
0b7181dd58 add kadm5_ad_context
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13872 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-05-26 16:55:25 +00:00
Johan Danielsson
23edf06a5b rename header file flag macro
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11113 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-08-16 20:57:44 +00:00
Johan Danielsson
53d1dfb3a1 add more fields to client context; remove prototypes
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8654 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-07-11 15:58:57 +00:00
Assar Westerlund
b003cf8c08 (_kadm5_acl_check_permission): update prototype
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8351 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-06-07 11:13:06 +00:00
Assar Westerlund
22da605365 (kadm_ops): add kadm_nop
more prototypes


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8319 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-06-05 17:05:34 +00:00
Assar Westerlund
6e30943f99 (struct kadm_func): add chpass_principal_with_key
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8063 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-03-23 23:05:49 +00:00
Assar Westerlund
4b0b470708 (_kadm5_set_keys_randomly): add prototype
(kadm5_log_foreach): update prototype


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7513 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-04 23:09:34 +00:00
Johan Danielsson
a64011fae7 prototype
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7480 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-03 13:00:52 +00:00
Johan Danielsson
c5b916ca6f remove advertising clause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7464 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-02 17:05:13 +00:00
Johan Danielsson
e7b9616810 (kadm5_server_context): add config_params struct and remove acl_file;
bump protocol version number


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7330 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-11-09 17:57:03 +00:00
Assar Westerlund
1e21aad9f0 (_kadm5_client_recv): update prototype
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6957 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-09-13 02:56:53 +00:00
Assar Westerlund
98e06393a7 (_kadm5_setup_entry): change prototype
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6132 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-04 18:44:30 +00:00
Johan Danielsson
8e1f2aba53 proto
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6099 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-03 17:11:11 +00:00
Johan Danielsson
a6b3246ddd move stuff from kadm5_locl.h
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6071 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-03 16:32:03 +00:00
Johan Danielsson
7f969a9fdd Move _kadm5_{privs,string{_to_{string,privs} from kadm5_locl.h.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4515 ec53bebd-3082-4978-b11e-865c3cabbd6b
1998-03-01 05:10:24 +00:00
Johan Danielsson
569d00f1b8 Private functions.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4024 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-11-16 10:51:37 +00:00