qkrb_count_kt_entries()--Count Keytab Entries
Syntax
#include <krb5.h> void qkrb_count_kt_entries(char * keytab, char * principal, krb5_kvno version, int * count);Service Program Name: QSYS/QKRBGSS;
Default Public Authority: *USE
Threadsafe: Yes
The qkrb_count_kt_entries() function allows you to obtain the total count of entries in a keytab file or count the number of keytab entries there are for a particular principal.
Authorities and Locks
Object | Authority Required |
---|---|
All directories in the path to the keytab file | *X |
Keytab file | *R |
Parameters
- keytab (Input)
- The name of the keytab file that will be searched.
NULL The default keytab file will be searched. - principal (Input)
- The principal name of the keytab entries being counted.
NULL Include keytab entries with any principal name in the count.
- version (Input)
- The version number of the keytab entries being counted.
0 Include keytab entries with any version in the count. - count (Output)
- The total number of entries in the keytab file that meet the search
criteria specified in the principal name and version number parameters.
Error Messages
Message ID | Error Message Text |
---|---|
CPE3C3C E | Value for parameter & not valid. |
CPE4ABB E | Network Authentication Service failed with return code &1. |
Example
The following example will count the number of keytab entries in the default keytab file.
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
#include <krb5.h> #include <string.h.h> #include <stdio.h.h> int main(int argc, char *argv[]) { /* Count the number of keytab entries in the default keytab */ /* file for the specified principal name and version number. */ /* This program accepts 2 parameters: */ /* 1: Pointer to keytab entry's principal name */ /* 2: Keytab entry's version number */ char *principal; krb5_kvno version; int return_count; /* Copy the address of the principal name and the value of the */ /* version number to local variables. */ principal = argv[1]; version = atoi(argv[2]); /* Clear the count. */ return_count = 0; /* Count the keytab entries. */ /* NOTE: When the first parameter, keytab, is set to NULL the */ /* default keytab file is used. The default keytab file */ /* is commonly: */ /* /QIBM/UserData/OS400/NetworkAuthentication/keytab/krb5.keytab */ qkrb_count_kt_entries(NULL, principal, version, &return_count); /* Print the count. */ printf ("%s Principal: \n", principal); printf ("%i Version number: \n", (int)version); printf ("%i Number of keytab entries: \n", return_count); return; }
API introduced: V5R3
[ Back to top | Security APIs | UNIX-Type APIs | APIs by category ]