summaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-09-20 09:13:09 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-02 14:12:13 +0200
commit1fd2a79a92fc30d7667eb97d0846043a9d29b5cf (patch)
treede3f2c35a023a678bdc3ba06270dcf64aeca411a /third_party
parent20302506324f11b55d21f14cba9e6476c6152da6 (diff)
downloadsamba-1fd2a79a92fc30d7667eb97d0846043a9d29b5cf.tar.gz
third_party: Update pam_wrapper to version 1.0.7
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/pam_wrapper/libpamtest.c31
-rw-r--r--third_party/pam_wrapper/pam_wrapper.c14
-rw-r--r--third_party/pam_wrapper/wscript2
3 files changed, 32 insertions, 15 deletions
diff --git a/third_party/pam_wrapper/libpamtest.c b/third_party/pam_wrapper/libpamtest.c
index 0a26c19c9ba..4474736d688 100644
--- a/third_party/pam_wrapper/libpamtest.c
+++ b/third_party/pam_wrapper/libpamtest.c
@@ -214,12 +214,11 @@ static int pamtest_simple_conv(int num_msg,
struct pam_response **response,
void *appdata_ptr)
{
- int i, ri = 0;
+ int i = 0;
int ret;
struct pam_response *reply = NULL;
const char *prompt;
- struct pamtest_conv_ctx *cctx = \
- (struct pamtest_conv_ctx *) appdata_ptr;
+ struct pamtest_conv_ctx *cctx = (struct pamtest_conv_ctx *)appdata_ptr;
if (cctx == NULL) {
return PAM_CONV_ERR;
@@ -241,15 +240,12 @@ static int pamtest_simple_conv(int num_msg,
if (reply != NULL) {
if (prompt != NULL) {
- ret = add_to_reply(&reply[ri], prompt);
+ ret = add_to_reply(&reply[i], prompt);
if (ret != PAM_SUCCESS) {
free_reply(reply, num_msg);
return ret;
}
- } else {
- reply[ri].resp = NULL;
}
- ri++;
}
cctx->echo_off_idx++;
@@ -264,18 +260,25 @@ static int pamtest_simple_conv(int num_msg,
if (reply != NULL) {
if (prompt != NULL) {
- ret = add_to_reply(&reply[ri], prompt);
+ ret = add_to_reply(&reply[i], prompt);
if (ret != PAM_SUCCESS) {
free_reply(reply, num_msg);
return ret;
}
}
- ri++;
}
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,
@@ -285,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,
@@ -298,7 +309,7 @@ static int pamtest_simple_conv(int num_msg,
}
}
- if (response && ri > 0) {
+ if (response != NULL) {
*response = reply;
} else {
free(reply);
diff --git a/third_party/pam_wrapper/pam_wrapper.c b/third_party/pam_wrapper/pam_wrapper.c
index 8064954ff47..48d2c2ae566 100644
--- a/third_party/pam_wrapper/pam_wrapper.c
+++ b/third_party/pam_wrapper/pam_wrapper.c
@@ -300,7 +300,15 @@ static void *pwrap_load_lib_handle(enum pwrap_lib lib)
void *handle = NULL;
#ifdef RTLD_DEEPBIND
- flags |= RTLD_DEEPBIND;
+ const char *env = getenv("LD_PRELOAD");
+
+ /* Don't do a deepbind if we run with libasan */
+ if (env != NULL && strlen(env) < PATH_MAX) {
+ const char *p = strstr(env, "libasan.so");
+ if (p == NULL) {
+ flags |= RTLD_DEEPBIND;
+ }
+ }
#endif
switch (lib) {
@@ -896,8 +904,6 @@ static void pwrap_init(void)
PWRAP_LOG(PWRAP_LOG_DEBUG, "Initialize pam_wrapper");
- pwrap_clean_stale_dirs(tmp_config_dir);
-
pwrap.config_dir = strdup(tmp_config_dir);
if (pwrap.config_dir == NULL) {
PWRAP_LOG(PWRAP_LOG_ERROR,
@@ -945,7 +951,7 @@ static void pwrap_init(void)
rc = mkdir(libpam_path, 0755);
if (rc != 0) {
PWRAP_LOG(PWRAP_LOG_ERROR,
- "Failed to create pam_wrapper config dir: %s - %s",
+ "Failed to create path for libpam: %s - %s",
tmp_config_dir, strerror(errno));
p_rmdirs(pwrap.config_dir);
exit(1);
diff --git a/third_party/pam_wrapper/wscript b/third_party/pam_wrapper/wscript
index ddc4bf85e11..f9ad73703de 100644
--- a/third_party/pam_wrapper/wscript
+++ b/third_party/pam_wrapper/wscript
@@ -2,7 +2,7 @@
import os
-VERSION="1.0.6"
+VERSION="1.0.7"
def find_library(library_names, lookup_paths):
for directory in lookup_paths: