Some checks failed
CI Code / Check spelling (pull_request) Successful in 14s
CI Code / Check coding style (pull_request) Successful in 24s
CI Code / Linux (debian) (pull_request) Failing after 45s
CI Code / Linux (arch) (pull_request) Failing after 51s
CI Code / Linux (ubuntu) (pull_request) Failing after 3m57s
CI Code / Code Coverage (pull_request) Failing after 6m19s
T04: promote security events to warnings — SASL auth failure, TLS handshake failure, cert-failure details, see-other-host redirect; DISABLE_TLS, TRUST_TLS and LEGACY_AUTH get a log warning plus a console notice (REQ-LOG-01, REQ-LOG-02, REQ-AUTH-03) T05: warn when a session ends up unencrypted without the user having asked for it; refuse in-band registration on an unencrypted stream; warn on each HTTP transfer with certificate verification disabled (REQ-CRY-03, REQ-CFG-01) T06: pin the update check to https with peer/host verification and no redirects; strict N.N.N parser for the fetched version, which is untrusted network input (REQ-VUL-02) T09: no plaintext logging on failed MUC OMEMO sends; OTR opportunistic first message passes allow_unencrypted_message(); get_random_string() draws from a CSPRNG without modulo bias; guard the identity-key length decrement against unsigned underflow (REQ-CRY-01, REQ-CRY-02, REQ-CRY-07, REQ-MEM-05) REQ-VUL-03 and REQ-CRY-09 are already satisfied on master and are left unchanged. The console warnings use cons_show_warning() from #87, so this needs that change in master first.
107 lines
2.7 KiB
C
107 lines
2.7 KiB
C
#include <glib.h>
|
|
#include "prof_cmocka.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#include <stabber.h>
|
|
|
|
#include "proftest.h"
|
|
|
|
void
|
|
connect_jid_requests_roster(void **state)
|
|
{
|
|
prof_connect();
|
|
|
|
assert_true(stbbr_received(
|
|
"<iq id='*' type='get'><query xmlns='jabber:iq:roster'/></iq>"
|
|
));
|
|
}
|
|
|
|
void
|
|
connect_jid_sends_presence_after_receiving_roster(void **state)
|
|
{
|
|
prof_connect();
|
|
|
|
assert_true(stbbr_received(
|
|
"<presence id='*'>"
|
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='*'/>"
|
|
"</presence>"
|
|
));
|
|
}
|
|
|
|
void
|
|
connect_jid_requests_bookmarks(void **state)
|
|
{
|
|
prof_connect();
|
|
|
|
assert_true(stbbr_received(
|
|
"<iq id='*' type='get'>"
|
|
"<query xmlns='jabber:iq:private'>"
|
|
"<storage xmlns='storage:bookmarks'/>"
|
|
"</query>"
|
|
"</iq>"
|
|
));
|
|
}
|
|
|
|
void
|
|
connect_bad_password(void **state)
|
|
{
|
|
char connect_cmd[128];
|
|
snprintf(connect_cmd, sizeof(connect_cmd), "/connect stabber@localhost server 127.0.0.1 port %d tls allow", stub_port);
|
|
prof_input(connect_cmd);
|
|
prof_input("badpassword");
|
|
|
|
assert_true(prof_output_exact("Login failed."));
|
|
}
|
|
|
|
void
|
|
connect_shows_presence_updates(void **state)
|
|
{
|
|
prof_connect();
|
|
|
|
stbbr_send(
|
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
|
"<show>dnd</show>"
|
|
"<status>busy!</status>"
|
|
"</presence>"
|
|
);
|
|
assert_true(prof_output_exact("Buddy1 (mobile) is dnd, \"busy!\""));
|
|
|
|
stbbr_send(
|
|
"<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
|
|
"<show>chat</show>"
|
|
"<status>Talk to me!</status>"
|
|
"</presence>"
|
|
);
|
|
assert_true(prof_output_exact("Buddy1 (laptop) is chat, \"Talk to me!\""));
|
|
|
|
stbbr_send(
|
|
"<presence to='stabber@localhost' from='buddy2@localhost/work'>"
|
|
"<show>away</show>"
|
|
"<status>Out of office</status>"
|
|
"</presence>"
|
|
);
|
|
assert_true(prof_output_exact("Buddy2 (work) is away, \"Out of office\""));
|
|
|
|
stbbr_send(
|
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
|
"<show>xa</show>"
|
|
"<status>Gone :(</status>"
|
|
"</presence>"
|
|
);
|
|
assert_true(prof_output_exact("Buddy1 (mobile) is xa, \"Gone :(\""));
|
|
}
|
|
|
|
void
|
|
connect_warns_on_insecure_transport(void **state)
|
|
{
|
|
/* the harness connects with "tls disable auth legacy": both downgrades must reach the console */
|
|
prof_connect();
|
|
|
|
prof_timeout(10);
|
|
assert_true(prof_output_exact("Warning: TLS is disabled, this connection is unencrypted."));
|
|
assert_true(prof_output_exact("Warning: Legacy authentication is enabled for this connection."));
|
|
prof_timeout_reset();
|
|
}
|