Skip to contentSkip to conversation

Add common_name to the conv method. This allows the common_name to be accessible in PAM.

PATCH In review Michael Karvan 2 participants 3 messages Dec 16, 2017 – Jan 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add common_name to the conv method. This allows the common_name to be accessible in PAM.

---
 src/plugins/auth-pam/auth-pam.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
src/plugins/auth-pam/auth-pam.c +8 -1
index ae514d7..c64e14b 100644
@@ -637,9 +637,16 @@ my_conv(int n, const struct pam_message **msg_array,
                         ret = PAM_CONV_ERR;
                     }
                     break;
+                
+                case PAM_TEXT_INFO:
+                    aresp[i].resp = strdup(up->common_name);
+                    if (aresp[i].resp == NULL)
+                    {
+                        ret = PAM_CONV_ERR;
+                    }
+                    break;
 
                 case PAM_ERROR_MSG:
-                case PAM_TEXT_INFO:
                     break;
 
                 default:
Signature · 1 line
2.1.4
#1 lore raw

Hi,

Quoted 10 lines · Michael Karvan
---
 src/plugins/auth-pam/auth-pam.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
src/plugins/auth-pam/auth-pam.c +0 -0
index ae514d7..c64e14b 100644
@@ -637,9 +637,16 @@ my_conv(int n, const struct pam_message **msg_array,
                         ret = PAM_CONV_ERR;

src/plugins/auth-pam/auth-pam.c my_conv(int n, const struct pam_message **msg_array, · line 647

Quoted 10 lines
src/plugins/auth-pam/auth-pam.c +8 -0
                     }
                     break;
+
+                case PAM_TEXT_INFO:
+                    aresp[i].resp = strdup(up->common_name);
+                    if (aresp[i].resp == NULL)
+                    {
+                        ret = PAM_CONV_ERR;
+                    }
+                    break;

The purpose of PAM_TEXT_INFO is for the module to send an info message to the user. Using it to send the common name back to the module is hackish. Yes, it can work in a custom module but its not right to interpret every
PAM_TEXT_INFO msg as a request for common name.

Why not prompt for it just like username and have the plugin return it?

Selva

#2 lore raw

Hi,

Quoted 31 lines · Selva Nair

Hi,

Quoted 10 lines · Michael Karvan
---
 src/plugins/auth-pam/auth-pam.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
src/plugins/auth-pam/auth-pam.c +0 -0
index ae514d7..c64e14b 100644
@@ -637,9 +637,16 @@ my_conv(int n, const struct pam_message **msg_array,
                         ret = PAM_CONV_ERR;

src/plugins/auth-pam/auth-pam.c my_conv(int n, const struct pam_message **msg_array, · line 647

Quoted 10 lines
src/plugins/auth-pam/auth-pam.c +8 -0
                     }
                     break;
+
+                case PAM_TEXT_INFO:
+                    aresp[i].resp = strdup(up->common_name);
+                    if (aresp[i].resp == NULL)
+                    {
+                        ret = PAM_CONV_ERR;
+                    }
+                    break;

The purpose of PAM_TEXT_INFO is for the module to send an info message to the user. Using it to send the common name back to the module is hackish. Yes, it can work in a custom module but its not right to interpret every
PAM_TEXT_INFO msg as a request for common name.

Quoted 1 line

Why not prompt for it just like username and have the plugin return it?

In case I was not clear enough. NAK on the current patch. A modified one could be considered.

Selva