From 07b7d66886601e1226e61bec9228d4be4ce45cea Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Tue, 20 Feb 2007 15:48:28 +0000 Subject: [PATCH] lock() didn't set user-defined locks properly --- src/fundb.c | 20 ++++++++++++-------- src/lock.c | 7 +++++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/fundb.c b/src/fundb.c index d6214fe..ad2521a 100644 --- a/src/fundb.c +++ b/src/fundb.c @@ -1076,14 +1076,17 @@ get_locktype(str) FUNCTION(fun_lock) { dbref it; - char *p; - lock_type ltype; + char *ltype = NULL; + lock_type real_ltype; - if ((p = strchr(args[0], '/'))) - *p++ = '\0'; + if ((ltype = strchr(args[0], '/'))) { + *ltypep++ = '\0'; + upcasestr(ltype); + } + + real_ltype = get_locktype(ltype); it = match_thing(executor, args[0]); - ltype = get_locktype(p); if (nargs == 2) { if (!command_check_byname(executor, "@lock") || fun->flags & FN_NOSIDEFX) { @@ -1097,9 +1100,10 @@ FUNCTION(fun_lock) return; } } - if (GoodObject(it) && (ltype != NULL) - && Can_Read_Lock(executor, it, ltype)) { - safe_str(unparse_boolexp(executor, getlock(it, ltype), UB_DBREF), buff, bp); + if (GoodObject(it) && (real_ltype != NULL) + && Can_Read_Lock(executor, it, real_ltype)) { + safe_str(unparse_boolexp(executor, getlock(it, real_ltype), UB_DBREF), + buff, bp); return; } safe_str("#-1", buff, bp); diff --git a/src/lock.c b/src/lock.c index 466934b..c22d76e 100644 --- a/src/lock.c +++ b/src/lock.c @@ -763,9 +763,12 @@ do_lock(dbref player, const char *name, const char *keyname, lock_type type) lmbuf[strlen(lmbuf)+1] = '\0'; set_lmod(thing, lmbuf); } - } else + } else { notify(player, T("Permission denied.")); - } + free_boolexp(key); + } + } else + free_boolexp(key); } } -- 2.30.2