@@ -529,10 +529,22 @@ public static synchronized void main(String[] args) {
529
529
String rootPath = null ;
530
530
int defaultPasswordExpiration = -1 ;
531
531
boolean autoProvision = false ;
532
- String jaasConfigFileStr = null ;
532
+ File jaasConfigFile = null ;
533
533
534
534
// Network name resolution disabled by default
535
535
InetNameLookup .setLookupEnabled (false );
536
+
537
+ // Initialize application
538
+ try {
539
+ ApplicationLayout layout = new GhidraServerApplicationLayout ();
540
+ ApplicationConfiguration configuration = new ApplicationConfiguration ();
541
+ configuration .setInitializeLogging (false );
542
+ Application .initializeApplication (layout , configuration );
543
+ }
544
+ catch (IOException e ) {
545
+ System .err .println ("Failed to initialize the application!" );
546
+ System .exit (-1 );
547
+ }
536
548
537
549
// Process command line options
538
550
for (int i = 0 ; i < args .length ; i ++) {
@@ -635,8 +647,10 @@ else if (defaultPasswordExpiration == 0) {
635
647
}
636
648
}
637
649
else if (s .startsWith ("-jaas" )) {
650
+ String jaasConfigFileStr ;
638
651
if (s .length () == 5 ) {
639
- jaasConfigFileStr = ((i + 1 ) < args .length - 1 ) ? args [++i ] : "" ;
652
+ i ++;
653
+ jaasConfigFileStr = (i < args .length ) ? args [i ] : "" ;
640
654
}
641
655
else {
642
656
jaasConfigFileStr = s .substring (5 );
@@ -646,6 +660,13 @@ else if (s.startsWith("-jaas")) {
646
660
displayUsage ("Missing -jaas config file path argument" );
647
661
System .exit (-1 );
648
662
}
663
+ jaasConfigFile = getServerCfgFile (jaasConfigFileStr );
664
+ if (!jaasConfigFile .isFile ()) {
665
+ displayUsage (
666
+ "JAAS config file (-jaas <configfile>) does not exist or is not file: " +
667
+ jaasConfigFile .getAbsolutePath ());
668
+ System .exit (-1 );
669
+ }
649
670
}
650
671
else if (s .equals ("-autoProvision" )) {
651
672
autoProvision = true ;
@@ -664,18 +685,6 @@ else if (s.equals("-autoProvision")) {
664
685
System .exit (-1 );
665
686
}
666
687
667
- // Initialize application
668
- try {
669
- ApplicationLayout layout = new GhidraServerApplicationLayout ();
670
- ApplicationConfiguration configuration = new ApplicationConfiguration ();
671
- configuration .setInitializeLogging (false );
672
- Application .initializeApplication (layout , configuration );
673
- }
674
- catch (IOException e ) {
675
- System .err .println ("Failed to initialize the application!" );
676
- System .exit (-1 );
677
- }
678
-
679
688
File serverRoot = new File (rootPath );
680
689
if (!serverRoot .isAbsolute ()) {
681
690
ResourceFile installRoot = Application .getInstallationDirectory ();
@@ -686,19 +695,11 @@ else if (s.equals("-autoProvision")) {
686
695
serverRoot = new File (installRoot .getFile (false ), rootPath );
687
696
}
688
697
689
- File jaasConfigFile = null ;
690
698
if (authMode == JAAS_LOGIN ) {
691
- if (jaasConfigFileStr == null ) {
699
+ if (jaasConfigFile == null ) {
692
700
displayUsage ("JAAS config file argument (-jaas <configfile>) not specified" );
693
701
System .exit (-1 );
694
702
}
695
- jaasConfigFile = getServerCfgFile (jaasConfigFileStr );
696
- if (!jaasConfigFile .isFile ()) {
697
- displayUsage (
698
- "JAAS config file (-jaas <configfile>) does not exist or is not file: " +
699
- jaasConfigFile .getAbsolutePath ());
700
- System .exit (-1 );
701
- }
702
703
}
703
704
704
705
try {
0 commit comments