Re: Wrapper for PAM

2024-10-11 Thread Alexander Zhirov via Digitalmars-d-learn
On Thursday, 10 October 2024 at 13:10:58 UTC, Salih Dincer wrote: On Thursday, 10 October 2024 at 12:58:22 UTC, Salih Dincer wrote: ```d class Auth { private: struct PAMdata { string password; string newPassword; } extern(C) { // 1. Salih changed it: stat

Re: Wrapper for PAM

2024-10-10 Thread Salih Dincer via Digitalmars-d-learn
On Thursday, 10 October 2024 at 12:58:22 UTC, Salih Dincer wrote: ```d class Auth { private: struct PAMdata { string password; string newPassword; } extern(C) { // 1. Salih changed it: static int conversation_func(int num_msg, const p

Re: Wrapper for PAM

2024-10-10 Thread Salih Dincer via Digitalmars-d-learn
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)

Re: Wrapper for PAM

2024-10-07 Thread evilrat via Digitalmars-d-learn
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)

Re: Wrapper for PAM

2024-10-07 Thread Alexander Zhirov via Digitalmars-d-learn
On Monday, 7 October 2024 at 08:23:08 UTC, Alexander Zhirov wrote: ``` module login.auth; import libpam; enum { AUTH_SUCCESS = 0, AUTH_ERR_USER = 1, AUTH_ERR_PASS = 2, AUTH_ERR_NPASS = 3, AUTH_ERR_START = 4, AUTH_ERR_AUTH = 5, AUTH_ERR_ACCT = 6, AUTH_ERR_CHTOK =

Re: Wrapper for PAM

2024-10-07 Thread Alexander Zhirov via Digitalmars-d-learn
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**

Re: Wrapper for PAM

2024-10-04 Thread Salih Dincer via Digitalmars-d-learn
On Friday, 4 October 2024 at 12:39:45 UTC, Alexander Zhirov wrote: On Thursday, 3 October 2024 at 23:56:37 UTC, Salih Dincer wrote I meant taking the function to D for the elements of the C syntax. To get only an API to which we can pass our callback, and hide everything else inside the wrappe

Re: Wrapper for PAM

2024-10-04 Thread Alexander Zhirov via Digitalmars-d-learn
On Thursday, 3 October 2024 at 23:56:37 UTC, Salih Dincer wrote I meant taking the function to D for the elements of the C syntax. To get only an API to which we can pass our callback, and hide everything else inside the wrapper. I have no experience porting from C to D, but I would like to tr

Re: Wrapper for PAM

2024-10-03 Thread Salih Dincer via Digitalmars-d-learn
On Thursday, 3 October 2024 at 22:54:53 UTC, Alexander Zhirov wrote: I want to try to make access via D to PAM. ```d /// I added it here: import pam_wrapper; int main(string[] args) { if (args.length < 3) { writeln("Usage: ", args[0], " "); return 1; } /// I added it h

Wrapper for PAM

2024-10-03 Thread Alexander Zhirov via Digitalmars-d-learn
I want to try to make access via D to PAM. I'm trying to write basic things. I would like to know how to best transform access to callback functions? For example, so that there is no need to cast to a type and use binding to `extern`, move all this to a library? ```d extern(C): struct pam_me