[IRCServices Coding] Associating NickGroupInfo with two nicks at once

Georges Berscheid georges at berscheid.lu
Tue Apr 22 07:40:25 PDT 2003


you might need to add the user that you want to get the privileges of 
one NickGroupInfo to the id_users array in that specific struct. This 
could help making the user being recognized as owner of the ngi.
Please note that this is a mere speculation, and that it is not based on 
any experience :)
Furthermore I don't think you should associate the ni reference to the 
user that does a SU, but only the ngi (which contains the privileges 
data), since the ni struct has a user member which can only be set to 
one specific user. So you will get in trouble if the real owner of the 
nick is online as well when any other use wants to get his privileges 
using SU.


Craig Edwards wrote:

>Hi, we're writing a module which allows a web interface to "su" to a nickname, similar to the way the unix "su" command (dont ask! :)) heres how it works:
>basically, /msg somepseudoclient su <nick> <pass>
>..and you gain the privilages of that nick, wether or not they are using it at the time. What we're doing at the moment is associating the user's ngi and ni fields with the nickgroupinfo of the registered nickname, e.g.
>NickInfo* MyNickInf = get_nickinfo(somenick);
>NickGroupInfo* MyNGroupInf = get_ngi(MyNickInf);
>u->ngi = MyNGroupInf;
>u->ni = MyNickInf;
>/* user u is now logged in with privilages of "ngi" nick, send +r as a raw if neccessary */
>sorry for any errors in this code, im typing it off the top of my head.
>Basically, the problem we have is, that only one nick can have "ownership" of a groupinfo at any one time, if we associate user 'u' with MyNGroupInf, then if some other user online at the time (lets call them u2) has this same association (u2->ngi == MyNGroupInf) than u2 is logged out (and has to re-identify using /msg nickserv identify <pass>). Basically we cant give two people ownership of the same nickgroup at the same time. Is there any way we can get around this, e.g. by memcpy'ing the NickGroupInfo? The ownership of the nick by the second user only needs to be temporary, until disconnect, so there shouldnt be any corruption of services DB's by having two people pointing at the same nickgroup in the file, or anything as weird as that :)
>If theres any way to solve this problem simply, without needing andy to rewrite the core, or for us to approach the problem a different way, we'd be grateful of anyone could tell us how :)
>ChatSpike Services-dev
>To unsubscribe or change your subscription options, visit: