Hace unos dias pregunte al foro si alguien me podia ayudar con las apis eim de asociaciones de kerberos. Bueno, a base de "pegarme" con ellas (estan en c) he conseguido hacer este programa que, pasandole como parametros, por este orden:

Identificador antiguo (lo borra) argv[1]
Identificador nuevo   (lo crea)   argv[2]
descripcion del identificador argv[3]
usuario de windows argv[4]
usuario de Iseries argv[5]

Crea el identificador y las asociaciones destino y origen.
 
En el fuente hay que sustituir, el usuario de conexion y su contraseña, nombres de registors Kerberos e iseries

Espero que os sea util.

#include <eim.h>                                                      
#include <stdio.h>                                                    
int main(int argc, char *argv[])                                      
                                                                     
{                                                                    
    int           rc;                                                
    char          eimerr[100];                                        
 /*   char          user;        */                                  
    EimRC       * err;                                                
    EimHandle     handle;                                            
    EimHandle     handle2;                                            
    EimIdentifierInfo x;                                              
                                                                     
                                                                     
    EimConnectInfo con;                                              
    char          unique[30];                                        
    unsigned int  sizeOfUnique = 30;                                    
                                                                       
   /*estructura de error                 */                            
                                                                       
    memset(eimerr,0x00,100);                                            
    err = (EimRC *)eimerr;                                              
    err->memoryProvidedByCaller = 100;                                  
    /* Create nuevo eim handle.    */                                  
    if (0 != (rc = eimCreateHandle(&handle2,                            
                                   NULL,                                
                                   err)))                              
  /*      printf("Create handle error = %d", rc);  */                  
    /* informacion de conexion         */                              
    con.type = EIM_SIMPLE ;                                            
    con.creds.simpleCreds.protect = EIM_PROTECT_NO;                    
        /* nombre calificado                 */                        
        con.creds.simpleCreds.bindDn = "os400-profile="">USUARIO,cn=accounts,
/*contraseña*/                              
    con.creds.simpleCreds.bindPw = "CONTRASEÑA";                          
    con.ssl = NULL;                                                    
                                                                       
    /* Conectar a la configuracion del sistema         */              
    if (0 != (rc = eimConnect(&handle2,                                
                              con,                                      
                              err)))                                    
 /*       printf("error de conexion = %d", rc);      */                
        /* Borrar identificador */                                      
        x.idtype = EIM_UNIQUE_NAME;                                    
        x.id.uniqueName = argv[1];                                      
    /* borrar identificador */                                          
    if (0 != (rc = eimRemoveIdentifier(&handle2,                        
                                       &x,                              
                                       err)))                          
  /*   printf("error al borrar identificador = %d", rc);*/              
    /* añadir identificador         */                                
    if (0 != (rc = eimAddIdentifier(&handle2,                          
                                    argv[2],                          
                                    EIM_FAIL,                          
                                    &sizeOfUnique,                    
                                    unique,                            
                                    argv[3],                          
                                    err)))                            
  /*  printf("error al añadir identificador = %d", rc); */            
    x.idtype = EIM_UNIQUE_NAME;                                        
    x.id.uniqueName =argv[2];                                          
                                                                       
    /* Añadir asociacion origen                 */                    
    if (0 != (rc = eimAddAssociation(&handle2,                        
                                     EIM_SOURCE,                      
                                     &x,                              
                                     "NOMBRE REGISTRO KERBEROS",                        
                                     argv[4],                          
                                     err)))                            
    {                                                                  
  /*      printf("error al añadir asociacion origen= %d", rc);   */    
    }                                                                  
    /* Añadir asociacion destino                 */                    
    if (0 != (rc = eimAddAssociation(&handle2,                        
                                     EIM_TARGET,                      
                                     &x,                              
                                     "NOMBRE REGISTRO ISERIES",          
                                     argv[5],                          
                                     err)))                            
    {                                                                  
 /*       printf("error al añadir asociacion destino = %d", rc);    */
                                                                       
  }                                                                    
                                                                       
       /* destruir handle                 */                            
  rc=eimDestroyHandle(&handle2,err);                                    
    return 0;                                                          
}                                                                      



Pedro Pinedo Hernandez:  Analista-Programador
Grupo Amcor Flexibles Hispania S.L.  
Planta: Tobepal Logroño
Departamento de Informática / IT Department
tfno.:+34 941 28 60 90 - 941 03 01 39
fax: +34 941 20 75 43
26006 Logroño Spain
[EMAIL PROTECTED]
(quitar nospam del dominio, para enviar)
_______________________________________________ AMCOR FLEXIBLES - LEADING THROUGH INNOVATION _______________________________________________ CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify AMCOR FLEXIBLES immediately. Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of AMCOR FLEXIBLES.

Responder a