]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-metadata.c
Don't abort startup when setgid/setuid() fails with EINVAL
[ngircd-alex.git] / src / ngircd / irc-metadata.c
index 9a3a94b363fd59e76544c849c86af884b2773626..00205f16a312d83c027906458deac98c83a6a500 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  */
 
 #include <assert.h>
-#include <string.h>
+#include <strings.h>
 #include <stdio.h>
 
 #include "conn-func.h"
 #include "channel.h"
-#include "conn-encoding.h"
+#include "irc-macros.h"
 #include "irc-write.h"
 #include "log.h"
 #include "messages.h"
 #include "parse.h"
-#include "tool.h"
 
 #include "irc-metadata.h"
 
@@ -49,6 +48,8 @@ IRC_METADATA(CLIENT *Client, REQUEST *Req)
        assert(Client != NULL);
        assert(Req != NULL);
 
+       _IRC_REQUIRE_PREFIX_OR_RETURN_(Client, Req)
+
        prefix = Client_Search(Req->prefix);
        if (!prefix)
                return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
@@ -71,7 +72,9 @@ IRC_METADATA(CLIENT *Client, REQUEST *Req)
        }
 
        if (strcasecmp(Req->argv[1], "cloakhost") == 0) {
-               Client_UpdateCloakedHostname(target, prefix, Req->argv[2]);
+               /* Set or remove a "cloaked hostname". */
+               Client_UpdateCloakedHostname(target, prefix,
+                                            *Req->argv[2] ? Req->argv[2] : NULL);
                if (Client_Conn(target) > NONE && Client_HasMode(target, 'x'))
                        IRC_WriteStrClientPrefix(target, prefix,
                                        RPL_HOSTHIDDEN_MSG, Client_ID(target),