Skip to content

Commit

Permalink
Remove CSD script when done with it
Browse files Browse the repository at this point in the history
We still don't remove it if the user hits Ctrl-C when we're logging in.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jul 12, 2012
1 parent db49d0a commit 06eff27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion library.c
Expand Up @@ -78,7 +78,10 @@ void openconnect_vpninfo_free (struct openconnect_info *vpninfo)
free(vpninfo->redirect_url);
free(vpninfo->proxy_type);
free(vpninfo->proxy);
free(vpninfo->csd_scriptname);
if (vpninfo->csd_scriptname) {
unlink(vpninfo->csd_scriptname);
free(vpninfo->csd_scriptname);
}
free(vpninfo->csd_stuburl);
/* These are const in openconnect itself, but for consistency of
the library API we do take ownership of the strings we're given,
Expand Down
4 changes: 4 additions & 0 deletions main.c
Expand Up @@ -762,6 +762,10 @@ int main(int argc, char **argv)
#endif

if (!vpninfo->cookie && openconnect_obtain_cookie(vpninfo)) {
if (vpninfo->csd_scriptname) {
unlink(vpninfo->csd_scriptname);
vpninfo->csd_scriptname = NULL;
}
fprintf(stderr, _("Failed to obtain WebVPN cookie\n"));
exit(1);
}
Expand Down

0 comments on commit 06eff27

Please sign in to comment.