Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 145839 | Differences between
and this patch

Collapse All | Expand All

(-)../4/poppassd.c (-18 / +24 lines)
Lines 92-97 Link Here
92
92
93
char **pamstrings[2]; // 0 - oldpass, 1 - newpass
93
char **pamstrings[2]; // 0 - oldpass, 1 - newpass
94
94
95
// The default PAM strings for old and new passwords
96
char *oldstr[] = {	"Password: ",
97
			"Enter login(LDAP) password: " };
98
99
char *newstr[] = {	"New password: ",
100
			"Re-enter new password: ",
101
			"Enter new UNIX password: ",
102
			"Retype new UNIX password: ",
103
			"New UNIX password: " };
104
95
void WriteToClient (char *fmt, ...)
105
void WriteToClient (char *fmt, ...)
96
{
106
{
97
	va_list ap;
107
	va_list ap;
Lines 136-144 Link Here
136
146
137
void setstrings(int argc, char **argv)
147
void setstrings(int argc, char **argv)
138
{
148
{
139
     int old=0, new=0, c;
149
     int old, new, c;
140
     extern int opterr;
150
     extern int opterr;
141
151
152
     old = sizeof(oldstr) / sizeof(oldstr[0]);
153
     new = sizeof(newstr) / sizeof(newstr[0]);
154
142
     opterr = 0;
155
     opterr = 0;
143
     while(1)
156
     while(1)
144
     {
157
     {
Lines 162-167 Link Here
162
     }
175
     }
163
     optind = 1;
176
     optind = 1;
164
177
178
     // add the default PAM strings present in oldstr and newstr to the end of pamstrings
179
     for(c = 0 ; c < (sizeof(oldstr) / sizeof(oldstr[0])) ; c++)
180
	     pamstrings[POP_OLDPASS][--old] = oldstr[c];
181
182
     for(c = 0 ; c < (sizeof(newstr) / sizeof(newstr[0])) ; c++)
183
	     pamstrings[POP_NEWPASS][--new] = newstr[c];
184
185
     // add the cli PAM arguments infront of the default ones (added above)
165
     while(1)
186
     while(1)
166
     {
187
     {
167
	     c = getopt(argc, argv, "n:o:");
188
	     c = getopt(argc, argv, "n:o:");
Lines 175-205 Link Here
175
{
196
{
176
	char **pammsg;
197
	char **pammsg;
177
198
178
       /* Interpret possible PAM messages (not including errors) */
199
	// check if PAM is asking for old password
179
	for(pammsg = pamstrings[POP_OLDPASS] ; *pammsg ; pammsg++)
200
	for(pammsg = pamstrings[POP_OLDPASS] ; *pammsg ; pammsg++)
180
		if(!strcmp(msg, *pammsg))
201
		if(!strcmp(msg, *pammsg))
181
			return POP_OLDPASS;
202
			return POP_OLDPASS;
182
203
183
       if(!strcmp(msg, "Password: "))
204
	// check if PAM is asking for new password
184
               return POP_OLDPASS;
185
       if(!strcmp(msg, "Enter login(LDAP) password: "))
186
               return POP_OLDPASS;
187
188
	for(pammsg = pamstrings[POP_NEWPASS] ; *pammsg ; pammsg++)
205
	for(pammsg = pamstrings[POP_NEWPASS] ; *pammsg ; pammsg++)
189
		if(!strcmp(msg, *pammsg))
206
		if(!strcmp(msg, *pammsg))
190
			return POP_NEWPASS;
207
			return POP_NEWPASS;
191
208
192
       if(!strcmp(msg, "New password: "))
193
               return POP_NEWPASS;
194
       if(!strcmp(msg, "Re-enter new password: "))
195
               return POP_NEWPASS;
196
       if(!strcmp(msg, "Enter new UNIX password: "))
197
               return POP_NEWPASS;
198
       if(!strcmp(msg, "Retype new UNIX password: "))
199
               return POP_NEWPASS;
200
       if(!strcmp(msg, "New UNIX password: "))
201
               return POP_NEWPASS;
202
203
       WriteToClient("Unknown PAM Message: %s", msg);  // We should not ever reach here.
209
       WriteToClient("Unknown PAM Message: %s", msg);  // We should not ever reach here.
204
210
205
       return POP_SKIPASS;
211
       return POP_SKIPASS;

Return to bug 145839