OpenBSD: hoist -o/printCert code to simplify
Nothing but the TLS handshake is required, so skip all other setup. On OpenBSD, unveil() handling needs fixing which will involve code reshuffling -- this is the first related but standalone step. Also pledge this one-off code path individually such with simpler and tighter promises while here.weechat-hashes
parent
7ea14eec84
commit
a989e156a1
19
chat.c
19
chat.c
|
@ -266,6 +266,19 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
if (!host) errx(EX_USAGE, "host required");
|
if (!host) errx(EX_USAGE, "host required");
|
||||||
|
|
||||||
|
if (printCert) {
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
unveilAll(trust, cert, priv);
|
||||||
|
int error = pledge("stdio rpath inet dns", NULL);
|
||||||
|
if (error) err(EX_OSERR, "pledge");
|
||||||
|
#endif
|
||||||
|
ircConfig(insecure, trust, cert, priv);
|
||||||
|
ircConnect(bind, host, port);
|
||||||
|
ircPrintCert();
|
||||||
|
ircClose();
|
||||||
|
return EX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (!nick) nick = getenv("USER");
|
if (!nick) nick = getenv("USER");
|
||||||
if (!nick) errx(EX_CONFIG, "USER unset");
|
if (!nick) errx(EX_CONFIG, "USER unset");
|
||||||
if (!user) user = nick;
|
if (!user) user = nick;
|
||||||
|
@ -300,12 +313,6 @@ int main(int argc, char *argv[]) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ircConfig(insecure, trust, cert, priv);
|
ircConfig(insecure, trust, cert, priv);
|
||||||
if (printCert) {
|
|
||||||
ircConnect(bind, host, port);
|
|
||||||
ircPrintCert();
|
|
||||||
ircClose();
|
|
||||||
return EX_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
uiInitEarly();
|
uiInitEarly();
|
||||||
if (save) {
|
if (save) {
|
||||||
|
|
Loading…
Reference in New Issue