@@ -3112,42 +3112,41 @@ Int_t TAuthenticate::SendRSAPublicKey(TSocket *socket, Int_t key)
31123112Int_t TAuthenticate::ReadRootAuthrc ()
31133113{
31143114 // rootauthrc family
3115- const char *authrc;
3116- TString temp_rootauthrc = " .rootauthrc" ;
3117- TString temp_system = " system.rootauthrc" ;
3115+ TString tRootAuthrc;
31183116 if (gSystem ->Getenv (" ROOTAUTHRC" ) != 0 ) {
3119- authrc = gSystem ->Getenv (" ROOTAUTHRC" );
3117+ tRootAuthrc = gSystem ->Getenv (" ROOTAUTHRC" );
31203118 } else {
3121- if (fgReadHomeAuthrc)
3122- authrc = gSystem ->PrependPathName (gSystem ->HomeDirectory (), temp_rootauthrc);
3119+ if (fgReadHomeAuthrc) {
3120+ tRootAuthrc = " .rootauthrc" ;
3121+ gSystem ->PrependPathName (gSystem ->HomeDirectory (), tRootAuthrc);
3122+ }
31233123 }
3124- if (authrc && gDebug > 2 )
3125- ::Info (" TAuthenticate::ReadRootAuthrc" , " Checking file: %s" , authrc );
3126- if (!authrc || gSystem ->AccessPathName (authrc , kReadPermission )) {
3127- if (authrc && gDebug > 1 )
3124+ if (!tRootAuthrc. IsNull () && gDebug > 2 )
3125+ ::Info (" TAuthenticate::ReadRootAuthrc" , " Checking file: %s" , tRootAuthrc.Data() );
3126+ if (tRootAuthrc. IsNull () || gSystem ->AccessPathName (tRootAuthrc , kReadPermission )) {
3127+ if (!tRootAuthrc. IsNull () && gDebug > 1 )
31283128 ::Info (" TAuthenticate::ReadRootAuthrc" ,
3129- " file %s cannot be read (errno: %d)" , authrc, errno);
3130- authrc = gSystem ->PrependPathName (TROOT::GetEtcDir (), temp_system);
3129+ " file %s cannot be read (errno: %d)" , tRootAuthrc.Data(), errno);
3130+ tRootAuthrc = " system.rootauthrc" ;
3131+ gSystem ->PrependPathName (TROOT::GetEtcDir (), tRootAuthrc);
31313132 if (gDebug > 2 )
3132- ::Info (" TAuthenticate::ReadRootAuthrc" , " Checking system file: %s" , authrc );
3133- if (gSystem ->AccessPathName (authrc , kReadPermission )) {
3133+ ::Info (" TAuthenticate::ReadRootAuthrc" , " Checking system file: %s" , tRootAuthrc.Data() );
3134+ if (gSystem ->AccessPathName (tRootAuthrc , kReadPermission )) {
31343135 if (gDebug > 1 )
31353136 ::Info (" TAuthenticate::ReadRootAuthrc" ,
3136- " file %s cannot be read (errno: %d)" , authrc , errno);
3137+ " file %s cannot be read (errno: %d)" , tRootAuthrc.Data() , errno);
31373138 return 0 ;
31383139 }
31393140 }
31403141
31413142 // Check if file has changed since last read
3142- TString tRootAuthrc = authrc;
31433143 if (tRootAuthrc == fgRootAuthrc) {
31443144 struct stat si;
31453145 stat (tRootAuthrc, &si);
31463146 if ((UInt_t)si.st_mtime < fgLastAuthrc.Convert ()) {
31473147 if (gDebug > 1 )
31483148 ::Info (" TAuthenticate::ReadRootAuthrc" ,
3149- " file %s already read" , authrc);
3150- delete [] authrc;
3149+ " file %s already read" , tRootAuthrc.Data());
31513150 return 0 ;
31523151 }
31533152 }
@@ -3172,17 +3171,16 @@ Int_t TAuthenticate::ReadRootAuthrc()
31723171 FILE *fd = 0 ;
31733172 // If the temporary file is open, copy everything to the new file ...
31743173 if (expand == 1 ) {
3175- TAuthenticate::FileExpand (authrc , ftmp);
3174+ TAuthenticate::FileExpand (tRootAuthrc , ftmp);
31763175 fd = ftmp;
31773176 rewind (fd);
31783177 } else {
31793178 // Open file
3180- fd = fopen (authrc , " r" );
3179+ fd = fopen (tRootAuthrc , " r" );
31813180 if (fd == 0 ) {
31823181 if (gDebug > 2 )
31833182 ::Info (" TAuthenticate::ReadRootAuthrc" ,
3184- " file %s cannot be open (errno: %d)" , authrc, errno);
3185- delete [] authrc;
3183+ " file %s cannot be open (errno: %d)" , tRootAuthrc.Data(), errno);
31863184 return 0 ;
31873185 }
31883186 }
@@ -3313,8 +3311,6 @@ Int_t TAuthenticate::ReadRootAuthrc()
33133311 fclose (fd);
33143312 if (expand == 1 )
33153313 gSystem ->Unlink (filetmp);
3316- // Cleanup allocated memory
3317- delete [] authrc;
33183314
33193315 // Update authinfo with new info found
33203316 TAuthenticate::MergeHostAuthList (authinfo,&tmpAuthInfo);
0 commit comments