Changeset 304:ad3c46016584 in freeDiameter for extensions/app_radgw
- Timestamp:
- May 14, 2010, 5:26:53 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- extensions/app_radgw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/app_radgw/CMakeLists.txt
r268 r304 4 4 5 5 # Overwrite the debug level for the extension code if configured 6 OPTION(DEBUG_LEVEL_APP_RADGW "Overwrite debug level for the extension app_radgw if defined " OFF)6 OPTION(DEBUG_LEVEL_APP_RADGW "Overwrite debug level for the extension app_radgw if defined (valid values: FULL, ANNOYING, CALL...)" OFF) 7 7 IF (DEBUG_LEVEL_APP_RADGW) 8 8 ADD_DEFINITIONS(-DTRACE_LEVEL=${DEBUG_LEVEL_APP_RADGW}) 9 9 ENDIF (DEBUG_LEVEL_APP_RADGW) 10 IF (NOT CMAKE_BUILD_TYPE MATCHES "Debug") 11 MARK_AS_ADVANCED(DEBUG_LEVEL_APP_RADGW) 12 ENDIF (NOT CMAKE_BUILD_TYPE MATCHES "Debug") 10 13 11 14 … … 65 68 SET_TARGET_PROPERTIES(${PLGNAME} PROPERTIES SUFFIX ".rgwx" ) 66 69 TARGET_LINK_LIBRARIES(${PLGNAME} rgw_common) 70 INSTALL(TARGETS ${PLGNAME} 71 LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH} 72 COMPONENT freeDiameter-radius-gateway) 67 73 ENDMACRO(RGWX_ADD_PLUGIN) 68 74 … … 103 109 RGWX_ADD_PLUGIN(echodrop ${RG_COMMON_HEADER} rgwx_echodrop.h rgwx_echodrop.c lex.rgwx_echodrop.c rgwx_echodrop.tab.c rgwx_echodrop.tab.h ) 104 110 ENDIF (BUILD_RGWX_ECHODROP) 111 112 113 #### 114 ## INSTALL section ## 115 116 INSTALL(TARGETS app_radgw 117 LIBRARY DESTINATION ${DEFAULT_EXTENSIONS_PATH} 118 COMPONENT freeDiameter-radius-gateway) 119 120 # Note that all compiled plugins are added by the RGWX_ADD_PLUGIN macro in the component freeDiameter-radius-gateway as well. -
extensions/app_radgw/rgw_conf.y
r258 r304 53 53 #include "rgw_conf.tab.h" /* bison is not smart enough to define the YYLTYPE before including this code, so... */ 54 54 55 #include <sys/stat.h>56 55 #include <sys/socket.h> 57 56 #include <arpa/inet.h> … … 97 96 else 98 97 fd_log_debug("%s:%d.%d : %s\n", conffile, ploc->first_line, ploc->first_column, s); 99 }100 101 /* This function checks a string value is a valid filename */102 static int is_valid_file( char * candidate )103 {104 int ret;105 struct stat buffer;106 107 ret = stat(candidate, &buffer);108 if (ret != 0) {109 fd_log_debug("Error on file '%s': %s.\n", candidate, strerror(errno));110 return 0;111 }112 113 /* Ok this candidate is valid */114 return 1;115 98 } 116 99 … … 161 144 %token <ss> IP 162 145 163 %type <string> FI LENAME146 %type <string> FINDFILEEXT 164 147 165 148 /* simple tokens */ … … 197 180 198 181 /* -------------------------------------- */ 199 FILENAME: QSTRING 200 { 201 /* Verify this is a valid file */ 202 if (!is_valid_file($1)) { 203 yyerror (&yylloc, conffile, "Error on file name, aborting..."); 204 YYERROR; 205 } 206 $$ = $1; 182 FINDFILEEXT: QSTRING 183 { 184 char * fname = $1; 185 FILE * fd; 186 187 /* First, check if the file exists */ 188 fd = fopen(fname, "r"); 189 if ((fd == NULL) && (*fname != '/')) { 190 char * bkp = fname; 191 CHECK_MALLOC_DO( fname = malloc( strlen(bkp) + strlen(DEFAULT_EXTENSIONS_PATH) + 2 ), 192 { yyerror (&yylloc, conffile, "Not enough memory"); YYERROR; } ); 193 sprintf(fname, DEFAULT_EXTENSIONS_PATH "/%s", bkp); 194 free(bkp); 195 fd = fopen(fname, "r"); 196 } 197 if (fd == NULL) { 198 int ret = errno; 199 TRACE_DEBUG(INFO, "Unable to open file %s for reading: %s\n", fname, strerror(ret)); 200 yyerror (&yylloc, conffile, "Error adding plugin"); 201 YYERROR; 202 } 203 fclose(fd); 204 205 $$ = fname; 207 206 } 208 207 ; … … 214 213 free(plgconffile); plgconffile = NULL; 215 214 } 216 PLG_PREFIX '=' FI LENAMEplg_attributes ';'215 PLG_PREFIX '=' FINDFILEEXT plg_attributes ';' 217 216 { 218 217 /* Add this extension in the list */
Note: See TracChangeset
for help on using the changeset viewer.