# LibAuth API Interface

**URL:** <https://community.openpbs.org/t/libauth-api-interface/1984>\
**Category:** Developers\
**Created:** [February 6, 2020, 8:51am UTC](https://community.openpbs.org/t/libauth-api-interface/1984 "2020-02-06T08:51:52Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![hirenvadalia](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/hirenvadalia/32/19_2.png) [@hirenvadalia](https://community.openpbs.org/u/hirenvadalia)\
**Post date:** [February 6, 2020, 8:51am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/1 "2020-02-06T08:51:52Z")

</div>

Hi,

I am working on the refactoring project in which I am introducing LibAuth for refactoring the authentication functionalities of PBS into a library for better maintainability.

[Here](https://pbspro.atlassian.net/wiki/spaces/PD/pages/1506279513/LibAuth+API+Interface+design) is LibAuth API interface design.

Please have a look and let me know your comments/suggestions/questions…

Thanks

---

<div class="post-metadata">

**Author:** ![subhasisb](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/subhasisb/32/12_2.png) [@subhasisb](https://community.openpbs.org/u/subhasisb)\
**Post date:** [February 12, 2020, 4:51am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/2 "2020-02-12T04:51:46Z")

</div>

Thanks - this is a great change. A few quick comments:

1. _ **auth\_set\_config** _ - in this api the first parameter “func” is actually a function pointer to a logger, why don’t we name the parameter as “logfunc” or “logger” to drive home that fact?

2. _ **auth\_create\_ctx** _ - instead of this api returning 0/1 error, we could return the context pointer back in return instead of a parameter of double indirection. So pointer if successful, else null? Unless, of course, we need more than a boolean return value.

3. _ **auth\_destroy\_ctx** _ - why does this api need a pointer to pointer as parameter?

4. _ **auth\_get\_userinfo** _ - could u please add examples or explanation as to how/when the realm is different and has useful information than just being the same as hostname?

5. _ **auth\_do\_handshake** _ - could the return value itself be used to indicate a “handshake\_done” instead of the last parameter? Like if you returned 2, handshake is done?

6. _ **auth\_set\_config** _ - what if a particular authentication library needs to have access to more than a single cred location? Or more “internal” configuration parameters. Let’s use an example. Let’s say in future we come up with a auth library has needs a switch to control its compression behavior - how can we pass this to the library, without making it part of a “config” interface? There exists several options of course: Instead of cred\_location, we could set a path to configuration file for the auth library, or we could pass options via env variables. Am not sure which one is better, but probably worth considering.

---

<div class="post-metadata">

**Author:** ![hirenvadalia](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/hirenvadalia/32/19_2.png) [@hirenvadalia](https://community.openpbs.org/u/hirenvadalia)\
**Post date:** [February 12, 2020, 5:46am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/3 "2020-02-12T05:46:27Z")

</div>

1. Sure will change `func` to `logfunc`.

2. The reason behind return 0/1 and using of double-pointer is PBS doesn’t care what’s the value of returned ctx, its just opaque value to PBS. And PBS only cares about the success or failure of API. Now take an example of current Munge authentication where it doesn’t have any ctx kinda stuff, so in this API returned ctx will be NULL but still call to API is a success. So now if PBS checks for ctx value is NULL or not then for Munge it will be marked as a failure.

3. The use of a double-pointer is to keep the same signature as create\_ctx for ctx value. But if we want we can change it to a single-pointer also.

4. Sure will add an example of GSS authentication where the realm will be different than the hostname.

5. There might be chances that a handshake is not done in one shot, for example in case mutual authentication methods like GSS/Kerberos, this API will be called multiple times, so PBS can’t say whether to mark as a failure or need more data or success from 0/1. Also same as point 1, PBS doesn’t know whether auth lib needs more data to complete a handshake or not… PBS only cares about the success or failure of call to API and whether handshake is done or not?

6. Honestly, I am also not sure which one is better, I am open to any option. 🙂

---

<div class="post-metadata">

**Author:** ![agrawalravi90](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@agrawalravi90](https://community.openpbs.org/u/agrawalravi90)\
**Post date:** [February 13, 2020, 12:32am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/4 "2020-02-13T00:32:05Z")

</div>

Thanks for sending this out Hiren. Some thoughts:

- Should we add the prefix “pbs” to all of these interfaces, or change “auth” to “pbsauth”? It will help avoid symbol collisions with other libraries.
- auth\_set\_config - Can this method be called multiple times? if not, how about calling this “init” instead of “set\_config”, that might better convey the fact that this routine needs to be called first, and only once. Also, I do like the idea of a config file to allow for adding other configuration options in the future.
- auth\_create\_ctx - I’m not sure I understand the purpose of “void \*\*ctx”. The API creates the context, so it must need ‘ctx’ to be in a particular form right? The client can’t just pass it an int pointer for example, right? So why is it a void \* ? Also, can you please explain the use case for having multiple contexts? if there’s only going to be one context at a time then maybe this should be created automatically by the library, hidden from clients.
- auth\_do\_handshake: it seems like this function won’t take care of the handshake completely, in which case, isn’t it just sending and receiving a message from a remote host? Maybe you can call it something else? I’d expect a handshake routine to take care of the entire handshake protocol.
- auth\_encrypt\_data: you mention “text data”, but the interface accepts a void\*. If the API expects text then maybe use char\* instead? Also, Should this interface take an “encryption method” argument? You haven’t mentioned what encryption method will be used for encryption, do we plan to only support one?

Thanks,  
Ravi

---

<div class="post-metadata">

**Author:** ![agrawalravi90](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@agrawalravi90](https://community.openpbs.org/u/agrawalravi90)\
**Post date:** [February 13, 2020, 12:34am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/5 "2020-02-13T00:34:38Z")

</div>

Ok, I just realized why we need multiple contexts, please ignore that question.

---

<div class="post-metadata">

**Author:** ![hirenvadalia](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/hirenvadalia/32/19_2.png) [@hirenvadalia](https://community.openpbs.org/u/hirenvadalia)\
**Post date:** [February 13, 2020, 4:41am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/6 "2020-02-13T04:41:42Z")

</div>

Thanks @agrawalravi90 for review.

> [@agrawalravi90](#):
>
> Should we add the prefix “pbs” to all of these interfaces, or change “auth” to “pbsauth”? It will help avoid symbol collisions with other libraries.

The only reason right now I have not added “pbs\_” prefix is, I wanted to make this API specs/interface completely generic so not just PBS but any other application (if at all in future) wants to use this interface for authentication and/or encrypt/decrypt data, they can use it.  
But if that’s not the case and still we want to add “pbs\_” prefix then I can add it.

> [@agrawalravi90](#):
>
> auth\_set\_config - Can this method be called multiple times? if not, how about calling this “init” instead of “set\_config”, that might better convey the fact that this routine needs to be called first, and only once. Also, I do like the idea of a config file to allow for adding other configuration options in the future.

Yes, you can call this method multiple times if you want to change the logger or cred location.

I don’t think “init” is the right word here, as we are not initializing the auth library, we are just giving it a few configuration parameters. In other words, if we say “init” that means we must have to call it before calling any other API, but here “auth\_set\_config” is not mandatory API that you have to call it. It should be called only if you want to change those configuration parameters. If you don’t care about those parameters, then still you can use other API.

About the config file, few questions:  
Who will create/maintain the config file?  
What should be the format of its content?  
Can we pass the function pointers in the config file? no right? then what will do for the function pointers (like logger method for now)?

Instead, how about using “structure” and in future will keep adding members to it as needed, and whatever library already implemented using old struct definition won’t have any problem because it doesn’t care about the newly added member unless it wants to use newly added members.  
Just to explain my thought better, see `set_tpp_config()` in PBS code ([here](https://github.com/PBSPro/pbspro/blob/eaa7e0f5571dbbced59461112d38ab4b26eb7ad7/src/lib/Libtpp/tpp_dis.c#L744)), we pass pbs\_conf structure to it but set\_tpp\_config() only uses few members of it, now if you add new member in pbs\_conf today then you don’t have to do any changes in set\_tpp\_config() unless you want to use newly added member in set\_tpp\_config()

> [@agrawalravi90](#):
>
> auth\_do\_handshake: it seems like this function won’t take care of the handshake completely, in which case, isn’t it just sending and receiving a message from a remote host? Maybe you can call it something else? I’d expect a handshake routine to take care of the entire handshake protocol.

So, the idea here is LibAuth will just take input data, process it and generate output data and now how/where to transfer those data is up to the application. Means LibAuth has no idea of how to connect to remote hosts or how to transfer data to socket etc…

Now why we need to make this way?  
There might be chances that one application can have multiple ways of connecting to remote hosts and transfer data between hosts.  
Take an example of PBS only, where you have two ways to connect to remote host one TCP and another TPP and both method has its way of connecting and transferring data between hosts. So either we have to teach all those ways to LibAuth or let PBS do it and LibAuth will take just take input data which PBS provides, process it and provide output data back to PBS and then PBS will transfer those data using appropriate method.

> [@agrawalravi90](#):
>
> auth\_encrypt\_data: you mention “text data”, but the interface accepts a void\*. If the API expects text then maybe use char\* instead? Also, Should this interface take an “encryption method” argument? You haven’t mentioned what encryption method will be used for encryption, do we plan to only support one?

I will change “text data” to “unencrypted data”.

About “encryption method”:  
We are using this API to encrypt data and get encrypted data back…  
Now how to encrypt data, what encryption method to use is up to this API (or implementation of auth library). This means whatever auth library providing us this API knows hows to encrypt data using which method, and we (aka application) have no idea about it (+ we don’t care about it).  
So no, we don’t want to pass the “encryption method” as an argument.

---

<div class="post-metadata">

**Author:** ![subhasisb](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/subhasisb/32/12_2.png) [@subhasisb](https://community.openpbs.org/u/subhasisb)\
**Post date:** [February 13, 2020, 7:41am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/7 "2020-02-13T07:41:43Z")

</div>

> Blockquote

> [@hirenvadalia](#):
>
> The reason behind return 0/1 and using of double-pointer is PBS doesn’t care what’s the value of returned ctx, its just opaque value to PBS. And PBS only cares about the success or failure of API. Now take an example of current Munge authentication where it doesn’t have any ctx kinda stuff, so in this API returned ctx will be NULL but still call to API is a success. So now if PBS checks for ctx value is NULL or not then for Munge it will be marked as a failure.

Makes sense - thanks

> [@hirenvadalia](#):
>
> - The use of a double-pointer is to keep the same signature as create\_ctx for ctx value. But if we want we can change it to a single-pointer also.

Yes, i think making it single indirection will be less confusing - double indirections are really used to return values

> [@hirenvadalia](#):
>
> There might be chances that a handshake is not done in one shot, for example in case mutual authentication methods like GSS/Kerberos, this API will be called multiple times, so PBS can’t say whether to mark as a failure or need more data or success from 0/1. Also same as point 1, PBS doesn’t know whether auth lib needs more data to complete a handshake or not… PBS only cares about the success or failure of call to API and whether handshake is done or not?

Sounds good

> [@hirenvadalia](#):
>
> Honestly, I am also not sure which one is better, I am open to any option.

Perhaps, we will deal with it when we learn more

---

<div class="post-metadata">

**Author:** ![subhasisb](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/subhasisb/32/12_2.png) [@subhasisb](https://community.openpbs.org/u/subhasisb)\
**Post date:** [February 13, 2020, 7:42am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/8 "2020-02-13T07:42:31Z")

</div>

> [@hirenvadalia](#):
>
> The only reason right now I have not added “pbs\_” prefix is, I wanted to make this API specs/interface completely generic so not just PBS but any other application (if at all in future) wants to use this interface for authentication and/or encrypt/decrypt data, they can use it.  
> But if that’s not the case and still we want to add “pbs\_” prefix then I can add it.

I feel the API is really for PBS and we are not attempting to build a generic library for all kinds of applications, hence to sort of namespace it out with a pbs\_ might be better

---

<div class="post-metadata">

**Author:** ![hirenvadalia](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/hirenvadalia/32/19_2.png) [@hirenvadalia](https://community.openpbs.org/u/hirenvadalia)\
**Post date:** [February 13, 2020, 9:05am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/9 "2020-02-13T09:05:22Z")

</div>

Ok then will add “pbs\_” prefix.

---

<div class="post-metadata">

**Author:** ![hirenvadalia](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/hirenvadalia/32/19_2.png) [@hirenvadalia](https://community.openpbs.org/u/hirenvadalia)\
**Post date:** [February 13, 2020, 9:05am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/10 "2020-02-13T09:05:46Z")

</div>

> [@subhasisb](#):
>
> Yes, i think making it single indirection will be less confusing - double indirections are really used to return values

Ok, will change it to single pointer.

---

<div class="post-metadata">

**Author:** ![agrawalravi90](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@agrawalravi90](https://community.openpbs.org/u/agrawalravi90)\
**Post date:** [February 13, 2020, 10:03pm UTC](https://community.openpbs.org/t/libauth-api-interface/1984/11 "2020-02-13T22:03:54Z")

</div>

Thanks for your reply Hiren and explaining things in great detail. Some more comments:

> [@hirenvadalia](#):
>
> In other words, if we say “init” that means we must have to call it before calling any other API, but here “auth\_set\_config” is not mandatory API that you have to call it

But you do mention in the design doc that this should be called before any other API: “This API should be called first before calling any other LibAuth API.” If one wants to change the logger or cred location, they will have to restart/HUP the daemon anyways right?

> [@hirenvadalia](#):
>
> Instead, how about using “structure” and in future will keep adding members to it as needed

Ok, yes, I like that

> [@hirenvadalia](#):
>
> So, the idea here is LibAuth will just take input data, process it and generate output data and now how/where to transfer those data is up to the application. Means LibAuth has no idea of how to connect to remote hosts or how to transfer data to socket etc…

Ok, then it really is not doing any handshake at all. If it’s just processing the data to prepare for a handshake, then maybe call it “pbs\_auth\_prep\_handshake\_data()” or something similar ?

> [@hirenvadalia](#):
>
> So no, we don’t want to pass the “encryption method” as an argument.

Got it, thanks

---

<div class="post-metadata">

**Author:** ![hirenvadalia](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/hirenvadalia/32/19_2.png) [@hirenvadalia](https://community.openpbs.org/u/hirenvadalia)\
**Post date:** [February 14, 2020, 5:51am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/12 "2020-02-14T05:51:54Z")

</div>

> [@agrawalravi90](#):
>
> But you do mention in the design doc that this should be called before any other API: “This API should be called first before calling any other LibAuth API.”

Correct, it says “should be called” not “must be called”, which means its optional not mandatory to call before any API.

> [@agrawalravi90](#):
>
> If one wants to change the logger or cred location, they will have to restart/HUP the daemon anyways right?

No, you just have to call API again that’s it…

> [@agrawalravi90](#):
>
> Ok, then it really is not doing any handshake at all. If it’s just processing the data to prepare for a handshake, then maybe call it “pbs\_auth\_prep\_handshake\_data()” or something similar ?

No, it is doing handshake only… Now, why handshake API needs to connect to another party? to receive/send data right? now PBS has that functionality then why we need that again in this API?

- As I explained the earlier PBS has a different way of connecting to another party and we can’t teach all those methods to the auth library… so will keep an auth library free of networking stuff…

---

<div class="post-metadata">

**Author:** ![agrawalravi90](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@agrawalravi90](https://community.openpbs.org/u/agrawalravi90)\
**Post date:** [February 14, 2020, 6:21pm UTC](https://community.openpbs.org/t/libauth-api-interface/1984/13 "2020-02-14T18:21:56Z")

</div>

> [@hirenvadalia](#):
>
> No, you just have to call API again that’s it…

Trying to understand how this will work. Say somebody changes the credentials inside the ‘cred\_location’ file, how will the daemons get notified that this change has happened without a HUP or a restart ?

> [@hirenvadalia](#):
>
> Correct, it says “should be called” not “must be called”, which means its optional not mandatory to call before any API.

Again just trying to understand, how will the other functions work without the configuration being set first? Will _**pbs\_auth\_create\_ctx()**_ be successful without first calling _**pbs\_auth\_set\_config()**_ ?

> [@hirenvadalia](#):
>
> No, it is doing handshake only… Now, why handshake API needs to connect to another party? to receive/send data right? now PBS has that functionality then why we need that again in this API?
> 
> - As I explained the earlier PBS has a different way of connecting to another party and we can’t teach all those methods to the auth library… so will keep an auth library free of networking stuff…

If _**pbs\_auth\_do\_handshake()**_ doesn’t know how to talk to another host, then how will it do the handshake? Am I missing something?

---

<div class="post-metadata">

**Author:** ![hirenvadalia](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/hirenvadalia/32/19_2.png) [@hirenvadalia](https://community.openpbs.org/u/hirenvadalia)\
**Post date:** [February 17, 2020, 3:56am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/14 "2020-02-17T03:56:11Z")

</div>

> [@agrawalravi90](#):
>
> Trying to understand how this will work. Say somebody changes the credentials inside the ‘cred\_location’ file, how will the daemons get notified that this change has happened without a HUP or a restart ?

Once PBS gives cred\_location to the auth library then it’s auth library’s job to keep watch on that location and do whatever necessary to do when credentials get change in the given directory.

> [@agrawalravi90](#):
>
> Again just trying to understand, how will the other functions work without the configuration being set first? Will _**pbs\_auth\_create\_ctx()**_ be successful without first calling _**pbs\_auth\_set\_config()**_ ?

Yes, why not? If you in my PR, currently we have to implementation of auth library one for Munge and another for GSS/Kerberos. Now, if you both implementation then don’t make use of cred\_location as of now. So in such a case, if you don’t call set\_config() first then still you can call create\_ctx(), the only disadvantage will be printed on stderr instead of your desired location. So as I said earlier “pbs\_auth\_set\_config” is not mandatory API to call first before calling any other API but its recommended to call so you can get log messages at the proper place.

> [@agrawalravi90](#):
>
> If _**pbs\_auth\_do\_handshake()**_ doesn’t know how to talk to another host, then how will it do the handshake? Am I missing something?

Ok let me try to explain in other words:  
To understand better will divide a complete handshake in 3 part:

1. Connecting to another host
2. Sending/receiving handshake data to/from another host
3. Processing received data and generate handshake data to send

So from the above 3 parts, PBS handles 1st & 2nd (aka networking stuff of connecting and transferring data between hosts) while “pbs\_auth\_do\_handshake” handles the only 3rd.

So based on above we don’t need to teach or write anything networking related stuff in “pbs\_auth\_do\_handshake”.

HTH!

(If not then I suggest you go through [this page](https://pbspro.atlassian.net/wiki/spaces/PD/pages/1510604832/PR-1505+Introduce+LibAuth+and+refactoring+in+DIS+TPP+support+routines) and [this file](https://github.com/hirenvadalia/pbspro/blob/refactor/src/lib/Libauth/munge/munge_supp.c) and see an implementation for auth APIs for Munge authentication)

---

<div class="post-metadata">

**Author:** ![agrawalravi90](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@agrawalravi90](https://community.openpbs.org/u/agrawalravi90)\
**Post date:** [February 18, 2020, 8:22pm UTC](https://community.openpbs.org/t/libauth-api-interface/1984/15 "2020-02-18T20:22:17Z")

</div>

> [@hirenvadalia](#):
>
> Once PBS gives cred\_location to the auth library then it’s auth library’s job to keep watch on that location and do whatever necessary to do when credentials get change in the given directory.

Interesting. So do you envision a separate thread in libauth which will monitor cred\_location? Can there be a race condition? admin modified cred file at time t1 to remove credentials for user1, libauth notices the change at time t2, but in the meantime user1 accesses data from PBS between t1 and t2? If situations like this are possible then it might be better to put this responsibility on the admins and require them to HUP PBS daemons. What do you think?

> [@hirenvadalia](#):
>
> Yes, why not? If you in my PR, currently we have to implementation of auth library one for Munge and another for GSS/Kerberos. Now, if you both implementation then don’t make use of cred\_location as of now. So in such a case, if you don’t call set\_config() first then still you can call create\_ctx(), the only disadvantage will be printed on stderr instead of your desired location. So as I said earlier “pbs\_auth\_set\_config” is not mandatory API to call first before calling any other API but its recommended to call so you can get log messages at the proper place.

Ok, thanks for clarifying.

> [@hirenvadalia](#):
>
> 1. Connecting to another host
> 2. Sending/receiving handshake data to/from another host
> 3. Processing received data and generate handshake data to send
> 
> So from the above 3 parts, PBS handles 1st & 2nd (aka networking stuff of connecting and transferring data between hosts) while “pbs\_auth\_do\_handshake” handles the only 3rd.

Thanks, this is what I was thinking as well. When I look at a function named “pbs\_auth\_do\_handshake”, it makes me think that this function will do all of these 3 parts and not just the 3rd part, which actually seems to be more about pre and post processing of the handshake data than the actual handshake itself. That’s why I think that we should rename it to something like pbs\_auth\_cvt\_handshake\_data(). What do you think?

---

<div class="post-metadata">

**Author:** ![hirenvadalia](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/hirenvadalia/32/19_2.png) [@hirenvadalia](https://community.openpbs.org/u/hirenvadalia)\
**Post date:** [February 19, 2020, 3:36am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/16 "2020-02-19T03:36:54Z")

</div>

> [@agrawalravi90](#):
>
> Interesting. So do you envision a separate thread in libauth which will monitor cred\_location? Can there be a race condition? admin modified cred file at time t1 to remove credentials for user1, libauth notices the change at time t2, but in the meantime user1 accesses data from PBS between t1 and t2? If situations like this are possible then it might be better to put this responsibility on the admins and require them to HUP PBS daemons. What do you think?

I don’t think so that there will be any race condition. Unfortunately right now I don’t have any real implementation which can show what I am trying to explain here… but let me try to explain with some fake example:  
Let’s say cred\_location is directory which stores user’s password in encrypted format in file named with user’s name, like file “user1” will contain user1’s encrypted password, file “user2” will contain user2’s encrypted password… and libpass.so is the library which you implemented using libauth API specs…  
Now user1 invoked qstat -Qf, so qstat, first authenticate to PBS server then send statque req…  
So while authenticating to server first qstat will talk to libpass and ask for password for user1, and libpass with look for file called “user1” in given cred\_location and it will read it and return its content to qstat, then qstat will send it to server, now server (while validating received password) will give that password to libpass, and libpass will read file called “user1” from given cred\_location then match its content with received password, if match then validated else rejected…  
Now let’s say at time t1 admin removed file called “user1” and at time t2 user1 invokes qstat again, so qstat will fail to get its password because libpass fails to read “user1” file as there is not file called "user1 in given cred\_location. So no race condition…  
Now let’s say somehow user1 manage bypass libpass calls and sends its password to server but server will fail to validate password, because there is not “user1” file inside cred\_location (and user1 can’t change server to bypass libpass calls 🙂) so again no race condition…  
HTH!

> [@agrawalravi90](#):
>
> That’s why I think that we should rename it to something like pbs\_auth\_cvt\_handshake\_data(). What do you think?

Ok, (assuming “cvt” means “convert”) I think “pbs\_auth\_process\_handshake\_data()” will make more sense here (as this API is not converting handshake data but it is processing it…)

---

<div class="post-metadata">

**Author:** ![agrawalravi90](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@agrawalravi90](https://community.openpbs.org/u/agrawalravi90)\
**Post date:** [February 19, 2020, 4:02am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/17 "2020-02-19T04:02:30Z")

</div>

Ok, thanks a ton for explaining in detail, it’ll probably get more clear once I see it in action.

‘process’ instead of ‘cvt’ sounds good to me, thanks.

---

<div class="post-metadata">

**Author:** ![hirenvadalia](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.openpbs.org/hirenvadalia/32/19_2.png) [@hirenvadalia](https://community.openpbs.org/u/hirenvadalia)\
**Post date:** [February 28, 2020, 9:42am UTC](https://community.openpbs.org/t/libauth-api-interface/1984/18 "2020-02-28T09:42:54Z")

</div>

Hi,

I have made few updates in design for LibAuth, please have a look and provide your feedback.

Updates:

- pbs\_auth\_set\_config() -\> Now this API will accept only one argument, which is pointer of pbs\_auth\_config\_t struct
- pbs\_auth\_process\_handshake\_data() -\> Now “data\_out” argument should be considered as error data/message in case of failure (aka return 1 by this API)

–  
Hiren
