@@ -665,21 +665,17 @@ static void on_event(const base_event *ev) {
665665 if (id == NULL ) {
666666 break ;
667667 }
668- set_mfa_status (ev -> identifier , id -> MfaEnabled , true);
668+ set_mfa_status (ev -> identifier , true , true);
669669 send_tunnel_status ("status" );
670670 mfa_status_event mfa_sts_event = {
671- .Op = strdup ("mfa" ),
672- .Action = strdup (mfa_ev -> operation ),
673- .Identifier = strdup (mfa_ev -> identifier ),
671+ .Op = "mfa" ,
672+ .Action = mfa_ev -> operation ,
673+ .Identifier = mfa_ev -> identifier ,
674+ .Fingerprint = id -> FingerPrint ,
674675 .Successful = false
675676 };
676677
677- if (id -> FingerPrint ) {
678- mfa_sts_event .Fingerprint = strdup (id -> FingerPrint );
679- }
680-
681678 send_events_message (& mfa_sts_event , (to_json_fn ) mfa_status_event_to_json , true);
682- free_mfa_status_event (& mfa_sts_event );
683679 break ;
684680 }
685681
@@ -2167,17 +2163,17 @@ static int submit_mfa_opts(int argc, char *argv[]) {
21672163 int c , option_index , errors = 0 ;
21682164 optind = 0 ;
21692165
2170- tunnel_submit_mfa * submit_mfa_options = calloc ( 1 , sizeof ( tunnel_submit_mfa )) ;
2166+ tunnel_submit_mfa submit_mfa_options = {} ;
21712167 cmd .command = TunnelCommand_SubmitMFA ;
21722168
21732169 while ((c = getopt_long (argc , argv , "i:c:" ,
21742170 opts , & option_index )) != -1 ) {
21752171 switch (c ) {
21762172 case 'i' :
2177- submit_mfa_options -> identifier = optarg ;
2173+ submit_mfa_options . identifier = optarg ;
21782174 break ;
21792175 case 'c' :
2180- submit_mfa_options -> code = optarg ;
2176+ submit_mfa_options . code = optarg ;
21812177 break ;
21822178 default : {
21832179 fprintf (stderr , "Unknown option '%c'\n" , c );
@@ -2190,8 +2186,7 @@ static int submit_mfa_opts(int argc, char *argv[]) {
21902186 CHECK_COMMAND_ERRORS (errors );
21912187
21922188 size_t json_len ;
2193- cmd .data = tunnel_submit_mfa_to_json (submit_mfa_options , MODEL_JSON_COMPACT , & json_len );
2194- free (submit_mfa_options );
2189+ cmd .data = tunnel_submit_mfa_to_json (& submit_mfa_options , MODEL_JSON_COMPACT , & json_len );
21952190
21962191 return optind ;
21972192}
0 commit comments