1 #define _XOPEN_SOURCE 500
10 void change_password(struct isds_ctx
*ctx
,
11 const char *old_password
, const char *new_password
) {
12 printf("Changing password to: `%s'\n", new_password
);
13 if (old_password
&& new_password
&& !strcmp(old_password
, new_password
))
14 printf("(Same as old password)\n");
16 printf("(Old password omitted)\n");
17 isds_error err
= isds_change_password(ctx
, old_password
, new_password
,
20 printf("isds_change_password() failed: %s: %s\n",
21 isds_strerror(err
), isds_long_message(ctx
));
23 printf("isds_change_password() succeeded.\n"
24 "This should not happen");
30 struct isds_ctx
*ctx
= NULL
;
33 setlocale(LC_ALL
, "");
37 printf("isds_init() failed: %s\n", isds_strerror(err
));
41 isds_set_logging(ILF_ALL
& ~ILF_HTTP
, ILL_ALL
);
43 ctx
= isds_ctx_create();
45 printf("isds_ctx_create() failed");
48 err
= isds_set_timeout(ctx
, 10000);
50 printf("isds_set_timeout() failed: %s\n", isds_strerror(err
));
53 err
= isds_login(ctx
, url
, username(), password(), NULL
, NULL
);
55 printf("isds_login() failed: %s: %s\n", isds_strerror(err
),
56 isds_long_message(ctx
));
58 printf("Logged in :)\n");
62 /* Try some invalid invocations that should fail */
63 change_password(ctx
, password(), NULL
);
64 change_password(ctx
, password(), "");
65 change_password(ctx
, password(), password());
69 err
= isds_logout(ctx
);
71 printf("isds_logout() failed: %s\n", isds_strerror(err
));
75 err
= isds_ctx_free(&ctx
);
77 printf("isds_ctx_free() failed: %s\n", isds_strerror(err
));
83 printf("isds_cleanup() failed: %s\n", isds_strerror(err
));