From 219b5ca3ef9edc8f603805c26548b6825c39c5b4 Mon Sep 17 00:00:00 2001 From: Russell Jancewicz Date: Mon, 9 Jun 2014 20:56:32 -0400 Subject: [PATCH] updated README --- PyKAdminIterator.c | 4 +-- README.md | 62 +++++++++++++++++++++++++++++++--------------- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/PyKAdminIterator.c b/PyKAdminIterator.c index 797c26e..9df79af 100644 --- a/PyKAdminIterator.c +++ b/PyKAdminIterator.c @@ -22,9 +22,9 @@ static int PyKAdminIterator_init(PyKAdminIterator *self, PyObject *args, PyObjec if (self->kadmin->server_handle) { if (self->mode & iterate_principals) { - kadm5_get_principals(self->kadmin->server_handle, self->match, &(self->names), &(self->count)); + kadm5_get_principals(self->kadmin->server_handle, self->match, &self->names, &self->count); } else if (self->mode & iterate_policies) { - kadm5_get_policies(self->kadmin->server_handle, self->match, &(self->names), &(self->count)); + kadm5_get_policies(self->kadmin->server_handle, self->match, &self->names, &self->count); } } diff --git a/README.md b/README.md index ae7e529..12ff9ae 100644 --- a/README.md +++ b/README.md @@ -3,23 +3,45 @@ python-kadmin Python module for kerberos admin (kadm5) -Examples: - Change a password: - -> import kadmin -> -> kadm = kadmin.init_with_keytab("user@EXAMPLE.COM", "/path/to/file.keytab") - -> princ = kadm.get_princ("user@EXAMPLE.COM") - -> princ.change_password("correcthorsebatterystaple") - - List accounts: - -> import kadmin -> -> kadm = kadmin.init_with_keytab("user@EXAMPLE.COM", "/path/to/file.keytab") - -> for princ in kadm.principals(): - -> print princ +## Initilization + +### kadmin +```python +import kadmin + +kadm = kadmin.init_with_keytab("user/admin@EXAMPLE.COM", "/path/to/keytab") +kadm = kadmin.init_with_ccache("user/admin@EXAMPLE.COM", "/path/to/krb5cc") +kadm = kadmin.init_wiht_password("user/admin@EXAMPLE.COM", "aStrongPassword") +``` +### kadmin_local +used for direct database access as local root account. +```python +import kadmin_local as kadmin + +kadm = kadmin.local(); +``` +\* kadmin\_local also supports the other init\_with\_<method> initializers whereas kadmin does not support local. +It is advised that kadmin_local is used for rapid unpacked iteration, other tasks should be handled by the gssapi connection. + + +##Examples: +###Change a password: +```python +princ = kadm.get_princ("user@EXAMPLE.COM") +princ.change_password("correcthorsebatterystaple") +``` + +###Iteration: +```python +for princ in kadm.principals(): + # princ is a string + print princ + +for princ in kadm.principals('r*@EXAMPLE.COM'): + # princ is a string starting with 'r' and ending with '@EXAMPLE.COM' + print princ + +for princ in kadm.principals('*', unpack=True): + # princ is a kadmin principal object + print princ +```