read-only memory with php dynamic module?

From: Date: Wed, 19 Jan 2000 07:07:54 +0000
Subject: read-only memory with php dynamic module?
Groups: php.dev 
Request: Send a blank email to php-dev+get-14751@lists.php.net to get a copy of this message
Hello all, I've been trying to finish up and debug my PHP PAM interface, and I've come upon a rather odd error. The PHP PAM interface invokes pam_start(), which loads a series of pam modules. In subsequent function calls, these pam modules may call the pam conversation function, which allows the module to communicate arbitrarily with the user. Here is a snippet of code from the conversation function, a minimal test case that reproduces the problem: static int our_conv( int num_msg, const struct pam_message **msgm, struct pam_response **response, void *appdata_ptr ) { if (num_msg <= 0) return PAM_CONV_ERR; if (!response) { php3_error( E_WARNING, "Invalid pam_response struct." ); return PAM_CONV_ERR; } *response = NULL; return PAM_SUCCESS; } At the second-to-last line of code, the webserver segfaults. I've checked, and response is a valid pointer; in fact, it's adjacent to msgm, which is used successfully throughout the function (in a read-only capacity). I can even print the value of *response with no difficulties, but any attempts to assign to it results in a segfault. Is there any PHP-related reason why this memory location would be read-only? This same code works fine in libpam_misc's conversation function, so I don't see how the PAM modules would be to blame. I'll probably fire Apache up in the debugger to see exactly what's going on, but I figured I'd post a query here in case anyone had any insights. Thanks, -Steve Langasek postmodern programmer

« previous php.dev (#14751) next »