mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	cdr_pgsql: Fix crash when the module fails to load multiple times.
Missing or corrupt cdr_pgsql.conf configuration file can cause the second attempt to load the PostgreSQL CDR module to crash Asterisk via the Command Line Interface because a null CLI command is registered on the first failed attempt to load the module. Resolves: #736
This commit is contained in:
		
				
					committed by
					
						![asterisk-org-access-app[bot]](/avatar/58a64b62d62d5b23df7bc832f016f9db?size=40) asterisk-org-access-app[bot]
						asterisk-org-access-app[bot]
					
				
			
			
				
	
			
			
			
						parent
						
							e1db3027af
						
					
				
				
					commit
					f789b7765b
				
			| @@ -783,12 +783,23 @@ static int config_module(int reload) | ||||
|  | ||||
| static int load_module(void) | ||||
| { | ||||
| 	ast_cli_register_multiple(cdr_pgsql_status_cli, sizeof(cdr_pgsql_status_cli) / sizeof(struct ast_cli_entry)); | ||||
| 	int res; | ||||
|  | ||||
| 	if (config_module(0)) { | ||||
| 		return AST_MODULE_LOAD_DECLINE; | ||||
| 		res = AST_MODULE_LOAD_DECLINE; | ||||
| 	} else if (ast_cdr_register(name, ast_module_info->description, pgsql_log)) { | ||||
| 		res = AST_MODULE_LOAD_DECLINE; | ||||
| 	} else if (ast_cli_register_multiple(cdr_pgsql_status_cli, ARRAY_LEN(cdr_pgsql_status_cli))) { | ||||
| 		res = AST_MODULE_LOAD_DECLINE; | ||||
| 	} else { | ||||
| 		res = AST_MODULE_LOAD_SUCCESS; | ||||
| 	} | ||||
| 	return ast_cdr_register(name, ast_module_info->description, pgsql_log) | ||||
| 		? AST_MODULE_LOAD_DECLINE : 0; | ||||
|  | ||||
| 	if (res != AST_MODULE_LOAD_SUCCESS) { | ||||
| 		unload_module(); | ||||
| 	} | ||||
|  | ||||
| 	return res; | ||||
| } | ||||
|  | ||||
| static int reload(void) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user