qkrb_add_kt_entry()--Add Keytab Entry


  Syntax
 #include <krb5.h>

 void qkrb_add_kt_entry(char *     keytab,
                        char *     principal,
                        char *     password,
                        krb5_kvno  version);
 
  Service Program Name: QSYS/QKRBGSS;

  Default Public Authority: *USE

  Threadsafe: Yes

The qkrb_add_kt_entry() function allows you to add a keytab entry to a keytab file for a specified principal name. If a principal name and version number match an existing keytab entry, the entry is replaced.


Authorities and Locks



Parameters

keytab  (Input)
The name of the keytab file to receive the new entry.

principal  (Input)
The principal name for the new keytab entry.

Note: If the realm name is not included in the specified principal name, the default realm will be appended to the name.

password  (Input)
The password value for the new keytab entry.

version  (Input)
The version number for the new keytab entry.
Note: Keytab entries are identifed by their principal name's. The first time a keytab entry is created, the default version value is 1. If keytab entries exists for the specified principal, the default is to add 1 to the largest version number of the existing entries.

Error Messages



Example

The following example will add a keytab entry to 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>

int main(int argc, char *argv[])
{
    /* Add a keytab entry to the default keytab file for the          */  
    /* specified principal.                                           */
    /* This program accepts 2 parameters:                             */
    /*     1: Pointer to the principal name for the new keytab entry  */
    /*     2: Pointer to the password for the new keytab entry        */
   
    char *principal;
    char *password;

    /* Copy the address of the principal and the password to local    */
    /* variables.                                                     */
    principal = argv[1];
    password  = argv[2];

    /* Create the keytab entry for the specified principal.           */
    /*   NOTE:  When the first parameter, keytab, is set to NULL the  */
    /*          default keytab file is used.  The default file is     */
    /*          commonly:                                             */ 
    /* /QIBM/UserData/OS400/NetworkAuthentication/keytab/krb5.keytab  */
    qkrb_add_kt_entry(NULL, principal, password);

    return; 
}


API introduced: V5R3

[ Back to top | Security APIs | UNIX-Type APIs | APIs by category ]