| ... | ... |
@@ -4139,6 +4139,19 @@ static int cli_loadpwdb(FILE *fs, struct cl_engine *engine, unsigned int options |
| 4139 | 4139 |
continue; |
| 4140 | 4140 |
} |
| 4141 | 4141 |
|
| 4142 |
+ /* preprocess tdb with target type 0 */ |
|
| 4143 |
+ memset(&tdb, 0, sizeof(tdb)); |
|
| 4144 |
+ tdb.mempool = engine->mempool; |
|
| 4145 |
+ tdb.cnt[CLI_TDB_UINT]++; |
|
| 4146 |
+ tdb.val = (uint32_t *) mpool_realloc2(tdb.mempool, tdb.val, tdb.cnt[CLI_TDB_UINT] * sizeof(uint32_t)); |
|
| 4147 |
+ if(!tdb.val) {
|
|
| 4148 |
+ tdb.cnt[CLI_TDB_UINT] = 0; |
|
| 4149 |
+ ret = CL_EMEM; |
|
| 4150 |
+ break; |
|
| 4151 |
+ } |
|
| 4152 |
+ tdb.val[0] = 0; |
|
| 4153 |
+ tdb.target = &(tdb.val[0]); |
|
| 4154 |
+ |
|
| 4142 | 4155 |
/* use the tdb to track filetypes and check flevels */ |
| 4143 | 4156 |
attribs = cli_strdup(tokens[1]); |
| 4144 | 4157 |
if(!attribs) {
|
| ... | ... |
@@ -4147,19 +4160,6 @@ static int cli_loadpwdb(FILE *fs, struct cl_engine *engine, unsigned int options |
| 4147 | 4147 |
break; |
| 4148 | 4148 |
} |
| 4149 | 4149 |
|
| 4150 |
- /* preprocess tdb with target type 0 */ |
|
| 4151 |
- memset(&tdb, 0, sizeof(tdb)); |
|
| 4152 |
- tdb.mempool = engine->mempool; |
|
| 4153 |
- tdb.cnt[CLI_TDB_UINT]++; |
|
| 4154 |
- tdb.val = (uint32_t *) mpool_realloc2(tdb.mempool, tdb.val, tdb.cnt[CLI_TDB_UINT] * sizeof(uint32_t)); |
|
| 4155 |
- if(!tdb.val) {
|
|
| 4156 |
- tdb.cnt[CLI_TDB_UINT] = 0; |
|
| 4157 |
- ret = CL_EMEM; |
|
| 4158 |
- break; |
|
| 4159 |
- } |
|
| 4160 |
- tdb.val[0] = 0; |
|
| 4161 |
- tdb.target = &(tdb.val[0]); |
|
| 4162 |
- |
|
| 4163 | 4150 |
ret = init_tdb(&tdb, engine, attribs, passname); |
| 4164 | 4151 |
free(attribs); |
| 4165 | 4152 |
if(ret != CL_SUCCESS) {
|
| ... | ... |
@@ -4169,26 +4169,26 @@ static int cli_loadpwdb(FILE *fs, struct cl_engine *engine, unsigned int options |
| 4169 | 4169 |
break; |
| 4170 | 4170 |
} |
| 4171 | 4171 |
|
| 4172 |
- /* check container type */ |
|
| 4173 |
- if (!tdb.container) {
|
|
| 4174 |
- container = CLI_PWDB_ANY; |
|
| 4175 |
- } else {
|
|
| 4176 |
- switch (*(tdb.container)) {
|
|
| 4177 |
- case CL_TYPE_ANY: |
|
| 4178 |
- container = CLI_PWDB_ANY; |
|
| 4179 |
- break; |
|
| 4180 |
- case CL_TYPE_ZIP: |
|
| 4181 |
- container = CLI_PWDB_ZIP; |
|
| 4182 |
- break; |
|
| 4183 |
- case CL_TYPE_RAR: |
|
| 4184 |
- container = CLI_PWDB_RAR; |
|
| 4185 |
- break; |
|
| 4186 |
- default: |
|
| 4187 |
- cli_errmsg("cli_loadpwdb: Invalid conatiner specified to .pwdb signature\n");
|
|
| 4188 |
- return CL_EMALFDB; |
|
| 4189 |
- } |
|
| 4190 |
- } |
|
| 4191 |
- FREE_TDB(tdb); |
|
| 4172 |
+ /* check container type */ |
|
| 4173 |
+ if (!tdb.container) {
|
|
| 4174 |
+ container = CLI_PWDB_ANY; |
|
| 4175 |
+ } else {
|
|
| 4176 |
+ switch (*(tdb.container)) {
|
|
| 4177 |
+ case CL_TYPE_ANY: |
|
| 4178 |
+ container = CLI_PWDB_ANY; |
|
| 4179 |
+ break; |
|
| 4180 |
+ case CL_TYPE_ZIP: |
|
| 4181 |
+ container = CLI_PWDB_ZIP; |
|
| 4182 |
+ break; |
|
| 4183 |
+ case CL_TYPE_RAR: |
|
| 4184 |
+ container = CLI_PWDB_RAR; |
|
| 4185 |
+ break; |
|
| 4186 |
+ default: |
|
| 4187 |
+ cli_errmsg("cli_loadpwdb: Invalid conatiner specified to .pwdb signature\n");
|
|
| 4188 |
+ return CL_EMALFDB; |
|
| 4189 |
+ } |
|
| 4190 |
+ } |
|
| 4191 |
+ FREE_TDB(tdb); |
|
| 4192 | 4192 |
|
| 4193 | 4193 |
/* check the PWStorageType */ |
| 4194 | 4194 |
if(!cli_isnumber(tokens[2])) {
|