summaryrefslogtreecommitdiffstats
path: root/session.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2015-04-25 20:45:02 +0000
committerThomas Adam <thomas@xteddy.org>2015-04-25 20:45:02 +0000
commit72e9ebf2ece28c986050162bf4f401a6a7679f53 (patch)
treec31a424328859542a7a1248a9e411aac8fc5b3e9 /session.c
parent56e1132db485aeb0730ce7782533ca441e63afef (diff)
parenta568b9cadce002f6f7e8ee914c995242bd70cce5 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'session.c')
-rw-r--r--session.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/session.c b/session.c
index b56ec376..7d86f68d 100644
--- a/session.c
+++ b/session.c
@@ -69,6 +69,22 @@ session_find(const char *name)
return (RB_FIND(sessions, &sessions, &s));
}
+/* Find session by id parsed from a string. */
+struct session *
+session_find_by_id_str(const char *s)
+{
+ const char *errstr;
+ u_int id;
+
+ if (*s != '$')
+ return (NULL);
+
+ id = strtonum(s + 1, 0, UINT_MAX, &errstr);
+ if (errstr != NULL)
+ return (NULL);
+ return (session_find_by_id(id));
+}
+
/* Find session by id. */
struct session *
session_find_by_id(u_int id)