summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2008-09-21 13:56:37 +0100
committerRoger Leigh <rleigh@debian.org>2008-09-21 13:56:37 +0100
commit5e105fd0ee05c23c275a8b0baa232c7bb5b8a5aa (patch)
tree58d832c02baa2d056501a5a402a33c0942866e4c /bin
parent950361746bf21e9b36cd8ff8bcf24c044cce544d (diff)
downloadschroot-5e105fd0ee05c23c275a8b0baa232c7bb5b8a5aa.tar.gz
[sbuild::auth_conv_tty] Add weak reference to the auth object
Weak references are used in place of shared pointers to avoid circular references. The conversation handler can now access the auth object which called it. This is used to implement a custom prompt containing the username, in the same style as sudo.
Diffstat (limited to 'bin')
-rw-r--r--bin/schroot/schroot-main-base.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/schroot/schroot-main-base.cc b/bin/schroot/schroot-main-base.cc
index 1ce4e0ac..076a37ec 100644
--- a/bin/schroot/schroot-main-base.cc
+++ b/bin/schroot/schroot-main-base.cc
@@ -281,7 +281,8 @@ main_base::run_impl ()
/* Set up authentication timeouts. */
std::tr1::shared_ptr<sbuild::auth_conv>
- conv(new sbuild::auth_conv_tty);
+ conv(new sbuild::auth_conv_tty
+ (std::tr1::dynamic_pointer_cast<sbuild::auth>(this->session)));
time_t curtime = 0;
time(&curtime);
conv->set_warning_timeout(curtime + 15);