Skip to content
Snippets Groups Projects
Commit 4e6d8192 authored by rswindell's avatar rswindell
Browse files

Fix del_user() method: must set user.number before calling getuserdat().

parent d724e4e6
No related branches found
No related tags found
No related merge requests found
......@@ -1485,14 +1485,15 @@ js_del_user(JSContext *cx, uintN argc, jsval *arglist)
if((cfg=(scfg_t*)JS_GetPrivate(cx,obj))==NULL)
return(JS_FALSE);
JS_ValueToInt32(cx,argv[0],&n);
if(!JS_ValueToInt32(cx,argv[0],&n))
return(JS_FALSE);
user.number=n;
rc=JS_SUSPENDREQUEST(cx);
JS_SET_RVAL(cx, arglist, JSVAL_FALSE);
JS_SET_RVAL(cx, arglist, JSVAL_FALSE); /* fail, by default */
if(getuserdat(cfg, &user)==0
&& putuserrec(cfg,n,U_MISC,8,ultoa(user.misc|DELETED,str,16))==0
&& putusername(cfg,n,nulstr)==0)
JS_SET_RVAL(cx, arglist, JSVAL_TRUE);
JS_SET_RVAL(cx, arglist, JSVAL_TRUE); /* success */
JS_RESUMEREQUEST(cx, rc);
return(JS_TRUE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment