From: Led <led@ukr-fin.com.ua>
To: device@altlinux.org,
ALT Linux Sisyphus discussion list <sisyphus@altlinux.ru>
Subject: Re: [sisyphus] unreal ircd
Date: Fri, 27 May 2005 17:49:01 +0300
Message-ID: <200505271749.01776.led@ukr-fin.com.ua> (raw)
In-Reply-To: <42972C76.5010407@gmail.com>
В сообщении от Пятница 27 Май 2005 17:19 Vitaly Smirnov написал(a):
> Ну хотя вообще-то не всё так страшно там ;)
>
> Есть кусок кода, за это отвечающий:
> >#if defined(IRC_UID) && defined(IRC_GID)
> > if ((int)getuid() == 0) {
> > if ((IRC_UID == 0) || (IRC_GID == 0)) {
> > (void)fprintf(stderr,
> > "ERROR: SETUID and SETGID have not been set
>
> properly"
>
> > "\nPlease read your
>
> documentation\n(HINT:SETUID or SETGID can not be 0)\n");
>
> > exit(-1);
> > } else {
> > /*
> > * run as a specified user
> > */
> >
> > (void)fprintf(stderr,
> > "WARNING: ircd invoked as root\n");
> > (void)fprintf(stderr, " changing to uid
>
> %d\n",
>
> > IRC_UID);
> > (void)fprintf(stderr, " changing to gid
>
> %d\n",
>
> > IRC_GID);
> > (void)setgid(IRC_GID); // Вот тут и надо
>
> получить gid из "uircd"
>
> > (void)setuid(IRC_UID); // тут uid ;)
> > }
> > }
> >#endif
>
> В качестве решения можно просто в хидерном файле вместо gid/uid
> прописать "uircd" а в коде доставать gid/uid по имени.
> Вот только вопрос, какой функцией достать gid/uid ?
Если я не ошибаюсь, то имеет смысл глянуть на
man getpwent
man getgrent
Led.
prev parent reply other threads:[~2005-05-27 14:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-27 14:19 Vitaly Smirnov
2005-05-27 14:29 ` Dmitry Lebkov
2005-05-27 14:45 ` Vitaly Smirnov
2005-05-27 14:52 ` Led
2005-05-27 14:49 ` Led [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200505271749.01776.led@ukr-fin.com.ua \
--to=led@ukr-fin.com.ua \
--cc=device@altlinux.org \
--cc=sisyphus@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Sisyphus discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
public-inbox-index sisyphus
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.sisyphus
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git