Use proper e-mail address format everywhere.
[doldaconnect.git] / daemon / auth-pam.c
index 48dbcbd..54b18c5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Dolda Connect - Modular multiuser Direct Connect-style client
- *  Copyright (C) 2004 Fredrik Tolf (fredrik@dolda2000.com)
+ *  Copyright (C) 2004 Fredrik Tolf <fredrik@dolda2000.com>
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -99,20 +99,22 @@ static int pamconv(int nmsg, const struct pam_message **msg, struct pam_response
        }
        if(data->converr)
        {
-           for(; i < nmsg; i++)
-           {
-               (*resp)[i].resp = sstrdup("");
-               (*resp)[i].resp_retcode = PAM_SUCCESS;
-           }
+           for(i--; i >= 0; i--)
+               free((*resp)[i].resp);
+           free(*resp);
+           *resp = NULL;
            return(PAM_CONV_ERR);
        }
+       (*resp)[i].resp_retcode = PAM_SUCCESS;
        switch(msg[i]->msg_style)
        {
        case PAM_PROMPT_ECHO_OFF:
        case PAM_PROMPT_ECHO_ON:
            (*resp)[i].resp = sstrdup((char *)data->passdata);
            memset((void *)data->passdata, 0, strlen((char *)data->passdata));
-           (*resp)[i].resp_retcode = PAM_SUCCESS;
+           break;
+       default:
+           (*resp)[i].resp = NULL;
            break;
        }
     }
@@ -195,7 +197,7 @@ static void pamauththread(struct authhandle *auth)
     data->validctxt = 0;
 }
 
-static int pamauth(struct authhandle *auth, char *passdata)
+static int pamauth(struct authhandle *auth, struct socket *sk, char *passdata)
 {
     struct pamdata *data;