Advertisement
Guest User

Untitled

a guest
Jun 8th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 KB | None | 0 0
  1. Index: trunk/source/proto/xmpp/uim-protocols-xmpp-client.adb
  2. ===================================================================
  3. --- trunk/source/proto/xmpp/uim-protocols-xmpp-client.adb (revision 388)
  4. +++ trunk/source/proto/xmpp/uim-protocols-xmpp-client.adb (working copy)
  5. @@ -61,6 +61,8 @@
  6.  
  7. with Network.Utils;
  8.  
  9. +with GNUTLS.SASL;
  10. +
  11. package body UIM.Protocols.XMPP.Client is
  12.  
  13. use Ada.Strings.Unbounded;
  14. @@ -74,10 +76,11 @@
  15. use Sax.Readers;
  16. use Unicode.CES;
  17. use Unicode.CES.Utf8;
  18. - use Ada.Strings.Unbounded;
  19.  
  20. use Ada.Exceptions;
  21.  
  22. + use GNUTLS.SASL;
  23. +
  24. use type Ada.Streams.Stream_Element_Offset;
  25.  
  26. XML_String : Ada.Strings.Unbounded.Unbounded_String;
  27. @@ -89,21 +92,6 @@
  28. Host : String := "localhost";
  29. Password : String := "123";
  30.  
  31. - function Hex_To_Oct (Sum : String) return String is
  32. - Result : String (Sum'First .. Sum'Last / 2);
  33. - J : Integer := Sum'First;
  34. -
  35. - begin
  36. - for Idx in Result'Range loop
  37. - Result (Idx)
  38. - := Character'Val (Integer'Value (("16#" & Sum (J .. J + 1) & "#")));
  39. -
  40. - J := J + 2;
  41. - end loop;
  42. -
  43. - return Result;
  44. - end Hex_To_Oct;
  45. -
  46. --------------
  47. -- Create --
  48. --------------
  49. @@ -471,68 +459,6 @@
  50.  
  51. end Parse_Challenge;
  52.  
  53. -
  54. - function Generate_SASL_String (JID_Par : String;
  55. - Pass_Par : String;
  56. - Host_Par : String;
  57. - Nonce_Par : String) -- Generates SASL string
  58. - return String
  59. - is
  60. - CNonce : String := "1a2f0ee81279451956625d2368";
  61. -
  62. - SY : String := Hex_To_Oct (GNAT.MD5.Digest (JID_Par &
  63. - ":" &
  64. - Host_Par &
  65. - ":" &
  66. - Pass_Par));
  67. -
  68. - HA1 : String := GNAT.MD5.Digest (SY & ":"
  69. - & Nonce_Par
  70. - & ":" & CNonce);
  71. - HA2 : String := GNAT.MD5.Digest ("AUTHENTICATE:xmpp/" & Host_Par);
  72. - Z : String := GNAT.MD5.Digest (HA1 & ":"
  73. - & Nonce_Par
  74. - & ":00000001:"
  75. - & CNonce & ":auth:"
  76. - & HA2);
  77. -
  78. - Realm_Reply : String
  79. - := "username="""
  80. - & JID_Par
  81. - & """,realm=""" & Host_Par
  82. - & """,nonce=""" & Nonce_Par
  83. - & """,cnonce=""" & CNonce
  84. - & """,nc=00000001"
  85. - & ",qop=auth,digest-uri=""xmpp/"
  86. - & Host_Par
  87. - & """,response=" & Z
  88. - & ",charset=utf-8";
  89. -
  90. - X : Integer := 4 * (Realm_Reply'Length + 2) / 3;
  91. - Y : Integer := X + 2 * (X / 76);
  92. -
  93. - Realm_Reply_Base_64 : String (Realm_Reply'First .. Y);
  94. - Len : Natural;
  95. -
  96. - begin
  97. - Ada.Text_IO.Put_Line ("SY = " & SY);
  98. - Ada.Text_IO.Put_Line ("HA1 = " & HA1);
  99. - Ada.Text_IO.Put_Line ("HA2 = " & HA2);
  100. - Ada.Text_IO.Put_Line ("Z = " & Z);
  101. - Ada.Text_IO.Put_Line ("Realm_Reply = " & Realm_Reply);
  102. - Utils.Base64.Encode
  103. - (Network.Utils.To_Stream_Element_Array (Realm_Reply),
  104. - Realm_Reply_Base_64,
  105. - Len);
  106. - Ada.Text_IO.Put_Line ("Realm_Reply_Base_64 = " & Realm_Reply_Base_64);
  107. -
  108. - return
  109. - "<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>"
  110. - & Realm_Reply_Base_64 (Realm_Reply_Base_64'First .. Len)
  111. - & "</response>";
  112. -
  113. - end Generate_SASL_String;
  114. -
  115. -----------------------------
  116. -- Parse_Stream_Features --
  117. -----------------------------
  118. Index: trunk/source/agnutls/agnutls.gpr
  119. ===================================================================
  120. --- trunk/source/agnutls/agnutls.gpr (revision 387)
  121. +++ trunk/source/agnutls/agnutls.gpr (working copy)
  122. @@ -33,6 +33,8 @@
  123. -- $Revision$ $Author$
  124. -- $Date$
  125. ------------------------------------------------------------------------------
  126. +with "../core/network/network";
  127. +with "../utils/utils";
  128.  
  129. project Agnutls is
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement