krb5_build_principal_ext_va()--Build a Kerberos Principal Extended With Variable Argument List


  Syntax
 #include <stdarg.h>
 #include <krb5.h>

 krb5_error_code krb5_build_principal_ext_va(  
     krb5_context     context,
     krb5_principal *     ret_principal,  
     int        realm_length,
     krb5_const char *      realm,
     va_list        ap); 
  Service Program Name: QSYS/QKRBGSS

  Default Public Authority: *USE

  Threadsafe: Yes

The krb5_build_principal_ext_va() function builds a Kerberos principal from its component strings. It is similar to the krb5_build_principal_ext() routine, except the name components are specified as a variable argument list instead of as discrete parameters on the function call.


Authorities

No authorities are required.


Parameters

context  (Input)
The Kerberos context.

ret_principal  (Output)
The Kerberos principal. The krb5_free_principal() routine should be called to release the principal when it is no longer needed.

realm_length  (Input)
The length of the realm name.

realm  (Input)
The realm name.

ap  (Input)
A variable argument list consisting of name lengths and character pointers that specify one or more name components. The end of the components is indicated by specifying a name length of zero.

Return Value

If no errors occur, the return value is 0. Otherwise, a Kerberos error code is returned.


Error Messages

Message ID Error Message Text
CPE3418 E Possible APAR condition or hardware failure.


Example

Assume we have a function my_func that is called with a list of names. It could generate a Kerberos principal from these names as follows.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#include <stdarg.h>
#include <krb5.h>

krb5_error_code my_func(int realm_len, char *realm, ...) {
    va_list ap;
    krb5_error_code retval;

    va_start(ap, realm);

    retval = krb5_build_principal_ext_va(context, &princ,realm_len, realm, ap);

    va_end(ap);

    return retval;
}

int main(int argc, char *argv[]) {

    my_func(6, "forest", 5, "bambi", 5, "admin", 0);

    return 0;
}


API introduced: V5R1
Top | Security APIs | UNIX-Type APIs | APIs by category