pwrap: Add PAM_TEXT_INFO and PAM_ERROR_MSG to responses
authorAndreas Schneider <asn@samba.org>
Tue, 26 Jun 2018 06:46:44 +0000 (08:46 +0200)
committerAndreas Schneider <asn@samba.org>
Thu, 20 Sep 2018 10:07:08 +0000 (12:07 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
src/libpamtest.c

index 74da180d258a896c52efdfd200ce0efd6eeee2d5..4474736d688bd0fe9652cac1ba909fbdf05f502e 100644 (file)
@@ -271,6 +271,14 @@ static int pamtest_simple_conv(int num_msg,
                        cctx->echo_on_idx++;
                        break;
                case PAM_ERROR_MSG:
+                       if (reply != NULL) {
+                               ret = add_to_reply(&reply[i], msgm[i]->msg);
+                               if (ret != PAM_SUCCESS) {
+                                       free_reply(reply, num_msg);
+                                       return ret;
+                               }
+                       }
+
                        if (cctx->data->out_err != NULL) {
                                memcpy(cctx->data->out_err[cctx->err_idx],
                                       msgm[i]->msg,
@@ -280,6 +288,14 @@ static int pamtest_simple_conv(int num_msg,
                        }
                        break;
                case PAM_TEXT_INFO:
+                       if (reply != NULL) {
+                               ret = add_to_reply(&reply[i], msgm[i]->msg);
+                               if (ret != PAM_SUCCESS) {
+                                       free_reply(reply, num_msg);
+                                       return ret;
+                               }
+                       }
+
                        if (cctx->data->out_info != NULL) {
                                memcpy(cctx->data->out_info[cctx->info_idx],
                                       msgm[i]->msg,