static int test_altscrn_1049(MENU_ARGS) { vt_move(1,1); println(the_title); vt_move(3,1); println("Test private setmode 1049 (to/from alternate screen)"); vt_move(4,1); println("The next screen will be filled with E's down to the prompt."); vt_move(5,1); println("unless titeInhibit resource is set, or alternate-screen is disabled."); vt_move(7,5); decsc(); vt_move(max_lines-2,1); holdit(); /* cursor location will be one line down */ sm("?1049"); /* this saves the cursor location */ decaln(); /* fill the screen */ vt_move(max_lines-2,1); ed(0); holdit(); rm("?1049"); decrc(); check_rc(max_lines-1,1); vt_move(4,1); el(2); println("The original screen should be restored except for this line"); vt_move(max_lines-2,1); return MENU_HOLD; }
static int test_altscrn_47(MENU_ARGS) { vt_move(1,1); println(the_title); vt_move(3,1); println("Test private setmode 47 (to/from alternate screen)"); vt_move(4,1); println("The next screen will be filled with E's down to the prompt."); vt_move(7,5); decsc(); vt_move(max_lines-2,1); holdit(); sm("?47"); decaln(); /* fill the screen */ vt_move(15,7); decsc(); vt_move(max_lines-2,1); ed(0); holdit(); rm("?47"); decrc(); check_rc(7,5); vt_move(4,1); el(2); println("The original screen should be restored except for this line."); vt_move(max_lines-2,1); return MENU_HOLD; }
PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv) { pam_url_opts opts; int ret=0; int len = 0; char* addextra = "&PAM_SM_SESSION=close"; char* tmp = NULL; if ( PAM_SUCCESS != pam_get_item(pamh, PAM_USER, &opts.user) ) { ret++; debug(pamh, "Could not get user item from pam."); } if( PAM_SUCCESS != parse_opts(&opts, argc, argv, PAM_SM_SESSION) ) { ret++; debug(pamh, "Could not parse module options."); } len = strlen(opts.extra_field) + strlen(addextra) + 1; opts.extra_field = realloc(opts.extra_field, len); if (opts.extra_field == NULL) goto done; tmp = calloc(1, strlen(opts.extra_field) + 1); if (tmp == NULL) goto done; snprintf(tmp, strlen(opts.extra_field) + 1, "%s", opts.extra_field ); snprintf(opts.extra_field, len, "%s%s", addextra, tmp); free(tmp); if( PAM_SUCCESS != fetch_url(pamh, opts) ) { ret++; debug(pamh, "Could not fetch URL."); } if( PAM_SUCCESS != check_rc(opts) ) { ret++; debug(pamh, "Wrong Return Code."); } done: cleanup(&opts); if( 0 == ret ) { return PAM_SUCCESS; } else { debug(pamh, "Session not releasing. Failing."); return PAM_SESSION_ERR; } }