Wrapper for PAM
Salih Dincer
salihdb at hotmail.com
Thu Oct 10 12:58:22 UTC 2024
On Monday, 7 October 2024 at 08:23:08 UTC, Alexander Zhirov wrote:
> I tried to build a class with a private function
> `conversation_func` to call it inside the public authentication
> function. When compiling I get this message:
> ```
> source/login/auth.d(87,46): Deprecation: casting from extern
> (C) int delegate(int num_msg, const(pam_message**) msg,
> pam_response** resp, void* appdata_ptr) to extern (C) int
> function(int, const(pam_message**), pam_response**, void*)* is
> deprecated
> ```
> And when I start up, at the moment of calling the
> authentication function, I get `Segmentation fault`.
>
> Is the function identified differently in the class? How can
> this be fixed?
Would you try static this?
```d
// 1. Salih changed it:
extern(C) static int conversation_func(int num_msg, const
pam_message **msg, pam_response **resp, void *appdata_ptr)
{ /* ... */}
```
There is no need for `this`.
```d
// 2. Salih changed it:
pam_conv conv = {
cast(conversation*)&/*this.*/conversation_func,
appdata_ptr
};
```
SDB at 79
More information about the Digitalmars-d-learn
mailing list