Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PyKAdminIterator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
62 changes: 42 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```