[ejabberd] Clients

Robert Wills robert.wills at dicta.org.uk
Mon Aug 9 10:37:22 MSD 2004


On Mon, 2004-08-09 at 06:53, Martyn Baker wrote:
> Rob
> 
> Outlook removed this attachemnt, have you put this script anywhere else ?
> 
Here it is.  This way it'll show up in the mail archives too.

-Rob

***************************************************************************

diff -c ejabberd-0.7/src/ejabberd_auth.erl src/ejabberd_auth.erl
*** ejabberd-0.7/src/ejabberd_auth.erl	2004-07-05 22:51:22.000000000
+0100
--- src/ejabberd_auth.erl	2004-08-08 10:54:59.657976664 +0100
***************
*** 24,29 ****
--- 24,30 ----
  	 is_user_exists/1,
  	 remove_user/1,
  	 remove_user/2,
+      set_user/2,
  	 plain_password_required/0,
  	 check_password_ldap/2, % TODO: remove
  	 is_user_exists_ldap/1 % TODO: remove
***************
*** 194,199 ****
--- 195,205 ----
  	    mnesia:transaction(F)
      end.
  
+ set_user(User, Password) ->
+     F = fun() -> mnesia:write(#passwd{user = User,
+ 				     password = Password}) end,
+     mnesia:transaction(F).
+ 
  
  try_register(User, Password) ->
      case auth_method() of
Only in src/: ejabberd.log
Common subdirectories: ejabberd-0.7/src/eldap and src/eldap
Only in src/: erl_crash.dump
Only in src/: Makefile
Only in src/: Mnesia.ejabberd at daedalus
diff -c ejabberd-0.7/src/mod_configure.erl src/mod_configure.erl
*** ejabberd-0.7/src/mod_configure.erl	2004-05-16 21:13:38.000000000
+0100
--- src/mod_configure.erl	2004-08-08 10:54:59.666975296 +0100
***************
*** 403,408 ****
--- 403,433 ----
        end
      }]};
  
+ get_form(["config", "setuser"], Lang) ->
+     {result, [{xmlelement, "x", [{"xmlns", ?NS_XDATA}],
+ 	       [{xmlelement, "title", [],
+ 		 [{xmlcdata,
+ 		   translate:translate(
+ 		     Lang, "Add User")}]},
+ 	        {xmlelement, "instructions", [],
+ 	         [{xmlcdata,
+ 		   translate:translate(
+ 		     Lang, "Choose juid and password")}]},
+ 	      {xmlelement, "field", [{"type", "text-single"},
+ 				     {"label",
+ 				      translate:translate(Lang, "Juid")},
+ 				     {"var", "juid"}],
+ 	       [{xmlelement, "value", [], [{xmlcdata, "juid"}]}]},
+ 	      {xmlelement, "field", [{"type", "text-single"},
+ 				     {"label",
+ 				      translate:translate(Lang, "Password")},
+ 				     {"var", "password"}],
+ 	       [{xmlelement, "value", [], [{xmlcdata, "password"}]}]}
+ 	     ]}]};
+ 
+ 
+ 
+ 
  get_form(_, Lang) ->
      {error, ?ERR_SERVICE_UNAVAILABLE}.
  
***************
*** 702,707 ****
--- 727,750 ----
        end, XData),
      {result, []};
  
+ set_form(["config", "setuser"], Lang, XData) ->
+     case lists:keysearch("juid", 1, XData) of
+ 	false ->
+ 	    {error, ?ERR_BAD_REQUEST};
+ 	{value, {_, [""]}} ->
+ 	    {error, ?ERR_BAD_REQUEST};
+ 	{value, {_, [User]}} ->
+ 	        case lists:keysearch("password", 1, XData) of
+ 	        {value, {_, [Password]}} ->
+                 ejabberd_auth:set_user(User, Password),
+                 {result, []};
+             _ ->
+                 {error, ?ERR_BAD_REQUEST}
+             end;
+ 	_ ->
+ 	    {error, ?ERR_BAD_REQUEST}
+     end;
+ 
  set_form(_, Lang, XData) ->
      {error, ?ERR_SERVICE_UNAVAILABLE}.
  
diff -c ejabberd-0.7/src/mod_disco.erl src/mod_disco.erl
*** ejabberd-0.7/src/mod_disco.erl	2004-07-09 23:34:23.000000000 +0100
--- src/mod_disco.erl	2004-08-08 10:54:59.667975144 +0100
***************
*** 241,247 ****
       [?NODE("Host Name",            "config/hostname"),
        ?NODE("Access Control Lists", "config/acls"),
        ?NODE("Access Rules",         "config/access"),
!       ?NODE("Remove Users",         "config/remusers")
       ]};
  
  get_local_items(["config", _], Server, Lang) ->
--- 241,248 ----
       [?NODE("Host Name",            "config/hostname"),
        ?NODE("Access Control Lists", "config/acls"),
        ?NODE("Access Rules",         "config/access"),
!       ?NODE("Remove Users",         "config/remusers"),
!       ?NODE("Set User",   "config/setuser")
       ]};
  
  get_local_items(["config", _], Server, Lang) ->


> 
> Martyn
> 
> ----- Original Message ----- 
> From: "Robert Wills" <robert.wills at dicta.org.uk>
> To: "Martyn Baker" <Martyn.Baker at clara.co.uk>; <ejabberd at jabber.ru>
> Sent: Sunday, August 08, 2004 11:01 AM
> Subject: Re: [ejabberd] Clients
> 
> 
> > Hello Martyn,
> >
> > On Sun, 2004-08-08 at 11:38, Martyn Baker wrote:
> > > I'd be interested to find out more about the patch you have for adding
> > > users - I found that the version of tkabber I'm using at the moment
> works
> > > fine for adding, though what I'm trying to is find out is if I can
> restrict
> > > people from creating accounts to the sysadmin only.
> > >
> > That's exactly why I created this.  The patch (for 0.7) is attached.
> >
> > When using tkabber it "Set User" appears in the configuration tree.
> > Double clicking it brings up a form where you can enter a juid and
> > password, which will send something like the following to the server:
> >
> > <iq id='11' to='daedalus' type='set' xml:lang='en'><query
> > xmlns='ejabberd:config' node='config/setuser'><x xmlns='jabber:x:data'
> > type='submit'><field var='juid'><value>juid55</value></field><field
> > var='password'><value>password</value></field></x></query></iq>
> >
> > Note that this doesn't just add users-- it will also change the password
> > of existing users.
> >
> > This is the first time I've written a line of erlang so I'm not sure of
> > the quality of this.  That being said, all I did was copy and modify the
> > code for remove user.
> >
> > > As a point of interest, I'm running Ejabberd on Windows NT 4.
> > >
> > I'm on Linux but this shouldn't make a difference.
> >
> > -Rob
> >
> >



More information about the ejabberd mailing list