Advertisement
bueddl

Untitled

Apr 18th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.63 KB | None | 0 0
  1. 168                              svn_boolean_t *success)
  2. 169 {
  3. 170   const char *out; // unused
  4. 171   const char *mech;
  5. 172   const svn_string_t *arg = NULL, *in;
  6. 173   unsigned int outlen; // unsused
  7. 174   int result; // 0 = SASL_OK, -13 = SASL_FAIL
  8. 175   svn_boolean_t use_base64;
  9. 176   int i;  // debug usage
  10. 177   printf("try_auth\n");
  11. 178   *success = FALSE;
  12. 179
  13. 180   printf("- svn_ra_svn_read_tuple\n");
  14. 181   /* Read the client's chosen mech and the initial token. */
  15. 182   SVN_ERR(svn_ra_svn_read_tuple(conn, pool, "w(?s)", &mech, &in));
  16. 183
  17. 184   printf("mech: %s\n", mech);
  18. 185
  19. 186   if (strcmp(mech, "EXTERNAL") == 0 && !in)
  20. 187     in = svn_string_create(b->tunnel_user, pool);
  21. 188   else if (in)
  22. 189     in = svn_base64_decode_string(in, pool);
  23. 190
  24. 191
  25. 192
  26. 193   /* For CRAM-MD5, we don't base64-encode stuff. */
  27. 194   use_base64 = (strcmp(mech, "CRAM-MD5") != 0);
  28. 195
  29. 196   printf("- sasl_server_start\n");
  30. 197   result = sasl_server_start(sasl_ctx, mech,
  31. 198                              in ? in->data : NULL,
  32. 199                              in ? in->len : 0, &out, &outlen);
  33. 200   printf("in->data = ");
  34. 201   for (i = 0; i < in->len; i++)
  35. 202     printf("%c", in->data[i]);
  36. 203   printf("\n");
  37. 204
  38. 205   if (result != SASL_OK && result != SASL_CONTINUE)
  39. 206     return fail_auth(conn, pool, sasl_ctx);
  40. 207
  41. 208   while (result == SASL_CONTINUE)
  42. 209     {
  43. 210
  44. 211       svn_ra_svn_item_t *item;
  45. 212
  46. 213       arg = svn_string_ncreate(out, outlen, pool);
  47. 214       /* Encode what we send to the client. */
  48. 215       if (use_base64)
  49. 216         arg = svn_base64_encode_string2(arg, TRUE, pool);
  50. 217
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement