MCPcopy Create free account
hub / github.com/RsyncProject/rsync / negotiate_daemon_auth

Function negotiate_daemon_auth

compat.c:848–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

846}
847
848void negotiate_daemon_auth(int f_out, int am_client)
849{
850 char tmpbuf[MAX_NSTR_STRLEN];
851 int save_am_server = am_server;
852 int md4_is_old = 0;
853
854 if (!am_client)
855 am_server = 1;
856
857 if (daemon_auth_choices)
858 strlcpy(tmpbuf, daemon_auth_choices, MAX_NSTR_STRLEN);
859 else {
860 strlcpy(tmpbuf, protocol_version >= 30 ? "md5" : "md4", MAX_NSTR_STRLEN);
861 md4_is_old = 1;
862 }
863
864 if (am_client) {
865 recv_negotiate_str(-1, &valid_auth_checksums, tmpbuf, strlen(tmpbuf));
866 if (DEBUG_GTE(NSTR, 1)) {
867 rprintf(FINFO, "Client negotiated %s: %s\n", valid_auth_checksums.type,
868 valid_auth_checksums.negotiated_nni->name);
869 }
870 } else {
871 if (!parse_negotiate_str(&valid_auth_checksums, tmpbuf)) {
872 get_default_nno_list(&valid_auth_checksums, tmpbuf, MAX_NSTR_STRLEN, '\0');
873 io_printf(f_out, "@ERROR: your client does not support one of our daemon-auth checksums: %s\n",
874 tmpbuf);
875 exit_cleanup(RERR_UNSUPPORTED);
876 }
877 }
878 am_server = save_am_server;
879 if (md4_is_old && valid_auth_checksums.negotiated_nni->num == CSUM_MD4) {
880 valid_auth_checksums.negotiated_nni->num = CSUM_MD4_OLD;
881 valid_auth_checksums.negotiated_nni->flags = 0;
882 }
883}
884
885int get_subprotocol_version()
886{

Callers 2

auth_serverFunction · 0.85
auth_clientFunction · 0.85

Calls 6

strlcpyFunction · 0.85
recv_negotiate_strFunction · 0.85
parse_negotiate_strFunction · 0.85
get_default_nno_listFunction · 0.85
io_printfFunction · 0.85
rprintfFunction · 0.70

Tested by

no test coverage detected