[Server] Segfault when using UserAuthType_PAM

Questions regarding the use of the ANSI C SDK for Server or Client development or integration into customer products ...

Moderator: uasdkc

Post Reply
caspervanzoest
Full Member
Full Member
Posts: 8
Joined: 21 Oct 2016, 14:12

[Server] Segfault when using UserAuthType_PAM

Post by caspervanzoest »

Dear users,

After using the security examples for using authenticationhttp://documentation.unified-automation ... ation.html,
I would like to use the PAM library to authenticate login users from the Linux service itself, instead of (re)defining my login credentials.

Unfortunately, the program crashes inside the following build-in SDK method:

Code: Select all

UaServer_SetUserAuthenticationTypeEx(&uaServer, UserAuthType_PAM, OpcUa_Null);
This only happens when setting the second parameter to UserAuthType_PAM. (and after enabling it in auserver_config.h)
I've also linked the PAM lib to the program, and tested the lib individually without any issue.

This the code from which I am using in order to activate the PAM authentication:

Code: Select all

/* Set the endpoint configuration to use Username/Password logon */
    pEndpoint->uNoOfUserTokenPolicy = 1;
    pEndpoint->pUserTokenPolicy = OpcUa_Alloc(pEndpoint->uNoOfUserTokenPolicy * sizeof(OpcUa_UserTokenPolicy)); 
    OpcUa_UserTokenPolicy_Initialize(&pEndpoint->pUserTokenPolicy[0]);
    pEndpoint->pUserTokenPolicy[0].TokenType = OpcUa_UserTokenType_UserName;
    OpcUa_String_AttachReadOnly(&pEndpoint->pUserTokenPolicy[0].PolicyId, "UserName");
    OpcUa_String_AttachReadOnly(&pEndpoint->pUserTokenPolicy[0].SecurityPolicyUri, OpcUa_SecurityPolicy_Basic256);
    printf("before crash \n");
    UaServer_SetUserAuthenticationTypeEx(&uaServer, UserAuthType_PAM, OpcUa_Null);
    printf("after crash \n");
Result in terminal:
UA Server: Initializing Stack...
|0x0| 15:09:08.875Z OpcUa_ProxyStub_Initialize: Tracer has been initialized!
|0x0| 15:09:08.875Z OpcUa_ProxyStub_Initialize: Network Module...
|0x0| 15:09:08.875Z OpcUa_ProxyStub_Initialize: Network Module done!
before crash
Segmentation fault (core dumped)
I'm using Linux Fedora25 32bit.
Any suggestion is welcome.

Thanks in advance.

caspervanzoest
Full Member
Full Member
Posts: 8
Joined: 21 Oct 2016, 14:12

Re: [Server] Segfault when using UserAuthType_PAM

Post by caspervanzoest »

Update:
There was an issue with the Ccmake configuration I made. :-X

Post Reply