PageRenderTime 26ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/sblim-cmpi-dhcp-1.0/hashing/libuniquekey.c

#
C | 658 lines | 470 code | 120 blank | 68 comment | 62 complexity | 61afc922a3715ae63f7ff24e6d2336e8 MD5 | raw file
Possible License(s): EPL-1.0
  1. ///=====================================================================
  2. /// libuniquekey.c
  3. ///
  4. /// Š Copyright IBM Corp. 2007
  5. ///
  6. /// THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
  7. /// ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
  8. /// CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
  9. ///
  10. /// You can obtain a current copy of the Eclipse Public License from
  11. /// http://www.opensource.org/licenses/eclipse-1.0.php
  12. ///
  13. /// Authors : Riyashmon Haneefa <riyashh1 (at) in.ibm.com>
  14. ///
  15. ///=====================================================================
  16. #ifndef _GNU_SOURCE
  17. #define _GNU_SOURCE
  18. #endif
  19. #include <stdio.h>
  20. #include <unistd.h>
  21. #include <stdlib.h>
  22. #include <ctype.h>
  23. #include <string.h>
  24. #include <sys/types.h>
  25. #include <sys/wait.h>
  26. #include <sys/stat.h>
  27. #include <fcntl.h>
  28. #ifdef DEBUG1
  29. #define LOG(s,t) printf("%s: ......... %s\n", s, t);
  30. #else
  31. #define LOG(s,t)
  32. #endif
  33. #ifndef SYSCONFDIR
  34. #define SYSCONFDIR "/usr/local/etc"
  35. #endif
  36. /** The structure _UQ_linkedList is a linked list. Each node in this list would carry */
  37. /** the line number and the line itself from a file that this list points to. */
  38. typedef struct _UQ_linkedList{
  39. int lineno;
  40. char * line;
  41. struct _UQ_linkedList * nextline;
  42. } _UQ_linkedList;
  43. /** Method to delete all the nodes from a list following the node pointer passed as the argument to the method */
  44. void _UQ_delLinkedList(_UQ_linkedList * list)
  45. {
  46. LOG("delLinkedList", "Entered");
  47. _UQ_linkedList * temp = NULL;
  48. /** when the passed list pointer is the only node in the list */
  49. if(!list->nextline){
  50. free(list->line);
  51. free(list);
  52. }
  53. /** when there exist more nodes as a link list with the node passed as the argument being the head node, delete the entire list */
  54. for(temp = list->nextline; temp; temp = temp->nextline)
  55. {
  56. free(list->line);
  57. free(list);
  58. list = temp;
  59. }
  60. LOG("delLinkedList", "Exit");
  61. }
  62. /** Method to return a hexadecimal value represented by the string argument passed to the function*/
  63. unsigned long long _UQ_strToHex(char * buf)
  64. {
  65. unsigned long long val = 0;
  66. char * str;
  67. for (str = buf; isxdigit(*str) ; str++) {
  68. val <<= 4;
  69. if (isalpha(*str))
  70. val |= (int) (*str) - 'a' + 10;
  71. else if (isdigit(*str))
  72. val |= (int) (*str) - '0';
  73. }
  74. return val;
  75. }
  76. /** Method to return a decimal value represented by the string argument passed to the function*/
  77. unsigned long long _UQ_strToDec(char * buf)
  78. {
  79. unsigned long long val = 0;
  80. char * str;
  81. for (str = buf; isdigit(*str) ; str++) {
  82. val *= 10;
  83. val += (int) (*str) - '0';
  84. }
  85. return val;
  86. }
  87. /** Method used to arrive at the file name from the file name specified as a path */
  88. /** Method accepts the path to the file as the argument and returns the filename */
  89. char * _UQ_extractServiceName(char * filepath)
  90. {
  91. char * ret = NULL;
  92. char * sptr = filepath;
  93. LOG("extractServiceName", filepath);
  94. for( ; *sptr ; sptr++);
  95. for( ; *sptr != '/'; sptr--);
  96. ret = strdup(++sptr);
  97. return ret;
  98. }
  99. /** Method used to arrive at a key value to represent every line in the config file */
  100. /** accepts the seed as an argument which is the filename for which the keys are getting generated
  101. and returns a unsigned long long value as the key after manipulation with a predetermined constant */
  102. unsigned long long _UQ_initialiseKey(char * seed)
  103. {
  104. unsigned long long key = 0xa1b2c3d4;
  105. char * str = seed;
  106. for(;*str; str++)
  107. key = key * (int)(*str);
  108. return key;
  109. }
  110. /** Method used to generate the required files to support the technical key generation and manipulation */
  111. /** expects the filepath, the name of the file, the name of the file to hold the copy of the config file
  112. and the name of the file to hold the keys as arguments, returns nothing */
  113. void _UQ_setupFiles(char * filepath, char * filename, char * wbemname, char * keyname)
  114. {
  115. char * line = NULL, idfile[100];
  116. size_t len = 0;
  117. ssize_t read = 0;
  118. unsigned long long keyvalues = _UQ_initialiseKey(filename); /** the keyvalue is initialized */
  119. FILE * fconf = NULL, * fwbem = NULL, * fkey = NULL; /** file pointers for different files */
  120. LOG("setUpFiles", "Entered");
  121. fconf = fopen(filepath, "r"); /** fconf - the config file is to be opened in the read mode */
  122. fwbem = fopen(wbemname, "w"); /** fwbem - the file to retain the copy of the config file to be opened in write mode */
  123. fkey = fopen(keyname, "w"); /** fkey -the file to maintain the key values to be opened in write mode */
  124. LOG("setUpFiles", "Copying");
  125. /** loop reads the contents from the fconf file, if the read function is successful
  126. copies the contents to the same line in the fwbem file, copies the keyvalue earlier generated to the
  127. fkey file and increments the keyvalue.
  128. This continues till the entire fconf file is read and a copy is maintained in the fwbem file and
  129. also a key is generated for every line and maintained in the fkey file */
  130. while( (read = getline(&line, &len, fconf)) != -1){
  131. fprintf(fwbem, line);
  132. fprintf(fkey,"%llx\n",++keyvalues?keyvalues:++keyvalues);
  133. if(line)
  134. free(line);
  135. line = NULL;
  136. }
  137. LOG(filepath, wbemname);
  138. if(line)
  139. free(line);
  140. /** A file is created to store the final key value so that it stores the next value to start */
  141. sprintf(idfile,SYSCONFDIR "/UniqueKey/.%s.Id", filename);
  142. fclose(fconf);
  143. fclose(fwbem);
  144. fclose(fkey);
  145. fconf = fopen(idfile, "w");
  146. fprintf(fconf,"%llx\n", ++keyvalues? keyvalues: ++keyvalues);
  147. fclose(fconf);
  148. }
  149. /** Method used to convert the contents of the file passed as argument to a linked list with each node of type _UQ_linkedList
  150. holding the linenumber, the line string and a pointer for the next node */
  151. _UQ_linkedList * _UQ_fileToLinkedList(char * file)
  152. {
  153. char * line = NULL;
  154. size_t len = 0;
  155. ssize_t read;
  156. FILE * fd;
  157. int i = 1;
  158. _UQ_linkedList * ret = NULL, * list = NULL;
  159. LOG("fileToLinkedList", file);
  160. ret = (_UQ_linkedList *)malloc(sizeof(_UQ_linkedList));
  161. memset(ret, '\0', sizeof(_UQ_linkedList));
  162. list = ret;
  163. fd = fopen(file, "r"); /** open the file to be read */
  164. /** populate the linked list and stop when the EOF is met*/
  165. while( (read = getline(&line, &len, fd )) != -1) {
  166. list->lineno = i++;
  167. list->line = strdup(line);
  168. list->nextline = (_UQ_linkedList *)malloc(sizeof(_UQ_linkedList));
  169. memset(list->nextline, '\0', sizeof(_UQ_linkedList));
  170. list = list->nextline;
  171. list->nextline = NULL;
  172. if(line)
  173. free(line);
  174. line = NULL;
  175. }
  176. if(line)
  177. free(line);
  178. fclose(fd); /** close the file */
  179. return ret;
  180. }
  181. /** A method to insert new keys into the the positions mentioned using i and j lines in the .key file*/
  182. void _UQ_insertEntity(char * filename, _UQ_linkedList * lptr, int i, int j)
  183. {
  184. char idFile[50], value[20];
  185. char *cptr __attribute__((__unused__));
  186. unsigned long long key;
  187. FILE * fd;
  188. int count = j - i + 1;
  189. LOG("insertEntity", "Entered");
  190. _UQ_linkedList * first = NULL, * temp = NULL, * prev = NULL; /** pointers to traverse the linked list */
  191. first = (_UQ_linkedList *)malloc(sizeof(_UQ_linkedList));
  192. memset(first, '\0', sizeof(_UQ_linkedList));
  193. sprintf(idFile,SYSCONFDIR "/UniqueKey/.%s.Id",filename); /** get the Id file */
  194. fd = fopen(idFile, "r"); /** Read the Id file to retrieve the value of the key stored */
  195. cptr = fgets(value, 19, fd);
  196. fclose(fd);
  197. key = _UQ_strToHex(value);
  198. /** forms the list of new ids to be inserted */
  199. for(temp = first; count; count--){
  200. temp->lineno = 0;
  201. sprintf(value,"%llx\n", ++key? key: ++key);
  202. temp->line = strdup(value);
  203. temp->nextline = (_UQ_linkedList *)malloc(sizeof(_UQ_linkedList));
  204. memset(temp->nextline, '\0', sizeof(_UQ_linkedList));
  205. prev = temp;
  206. temp = temp->nextline;
  207. }
  208. fd = fopen(idFile, "w");
  209. fprintf(fd,"%llx\n", key);
  210. fclose(fd);
  211. /** inserts the new list into the existing file list which is available in lptr. */
  212. prev->nextline = lptr->nextline;
  213. lptr->nextline = first;
  214. LOG("insertEntity", "Exit");
  215. }
  216. /** A method to generate a new set of keys for the conf files which would be stored in the .key file */
  217. void _UQ_reCreateKeys(char * filename,char * conffile, char * wbemfile, char *keyfile){
  218. char idFile[50], value[20], * line = NULL;
  219. unsigned long long key;
  220. size_t len = 0;
  221. ssize_t read = 0;
  222. FILE *fd = NULL, * fconf = NULL, * fwbem = NULL, * fkey = NULL;
  223. LOG("reCreateKeys", "Entered");
  224. /** picks up the seed from the .Id file */
  225. sprintf(idFile, SYSCONFDIR "/UniqueKey/.%s.Id", filename);
  226. fd = fopen(idFile, "r");
  227. line = fgets(value, 19, fd);
  228. line = NULL;
  229. fclose(fd);
  230. key = _UQ_strToHex(value);
  231. fconf = fopen(conffile, "r");
  232. fwbem = fopen(wbemfile, "w");
  233. fkey = fopen(keyfile, "w");
  234. /** generates a new .key file using the seed got earlier. */
  235. while( (read = getline(&line, &len, fconf)) != -1){
  236. fprintf(fwbem, line);
  237. fprintf(fkey,"%llx\n",++key?key:++key);
  238. if(line)
  239. free(line);
  240. line = NULL;
  241. }
  242. fclose(fconf);
  243. fclose(fwbem);
  244. fclose(fkey);
  245. if(line)
  246. free(line);
  247. fd = fopen(idFile, "w");
  248. fprintf(fd, "%llx\n", key);
  249. fclose(fd);
  250. LOG("reCreateKey", "Exit");
  251. }
  252. /** A method to remove the lines between i and j from the .key file */
  253. void _UQ_deleteEntity(char * filename, _UQ_linkedList * lptr, _UQ_linkedList * prev, int i, int j)
  254. {
  255. LOG("deleteEntity", "Entered");
  256. _UQ_linkedList * temp;
  257. #ifdef DEBUG1
  258. printf("Line Start %d, End %d: List Start %d\n", i, j, lptr->lineno);
  259. #endif
  260. for(temp = lptr; temp->lineno != j; temp = temp->nextline);
  261. #ifdef DEBUG1
  262. printf("The last line %d\n", temp->lineno);
  263. #endif
  264. prev->nextline = temp->nextline;
  265. temp->nextline = NULL;
  266. _UQ_delLinkedList(lptr);
  267. LOG("deleteEntity", "Exit");
  268. }
  269. /** Method used to update the different files on which the hashing mechanism depends on. This is invoked if any changes
  270. are observed in the config file - due to manual modifications, adding or deleting any entities of conf file */
  271. int _UQ_upToDate(char * filename, char * conffile, char * wbemfile, char * keyfile, char * tmpfile, char * seed)
  272. {
  273. char * line, l1[5], l2[5], l3[5], l4[5], comm;
  274. int i, i1, i2, i3, i4, ret = 0;
  275. _UQ_linkedList tmplist, keylist, *lptr, *alptr, *dlptr, *prelptr = NULL;
  276. FILE * fd, *fconf, *fwbem;
  277. size_t len = 0;
  278. ssize_t read = 0;
  279. LOG("upToDate", "Entered");
  280. tmplist.lineno = 0;
  281. keylist.lineno = 0;
  282. tmplist.nextline = (_UQ_linkedList *)malloc(sizeof(_UQ_linkedList));
  283. memset(tmplist.nextline, '\0', sizeof(_UQ_linkedList));
  284. keylist.nextline = (_UQ_linkedList *)malloc(sizeof(_UQ_linkedList));
  285. memset(keylist.nextline, '\0', sizeof(_UQ_linkedList));
  286. keylist.nextline = _UQ_fileToLinkedList(keyfile);
  287. tmplist.nextline = _UQ_fileToLinkedList(tmpfile);
  288. /** extracting the variations that have occurred in the conf file */
  289. for(lptr = tmplist.nextline; lptr->nextline; lptr = lptr->nextline){
  290. if(!isdigit((int)(lptr->line[0])))
  291. continue;
  292. line = lptr->line;
  293. for(i = 0; isdigit(*line) ; line++)
  294. l1[i++] = *line;
  295. l1[i] = 0;
  296. i1 = _UQ_strToDec(l1);
  297. if(*line == ','){
  298. for(i = 0, line++; isdigit(*line) ; line++)
  299. l2[i++] = *line;
  300. l2[i] = 0;
  301. i2 = _UQ_strToDec(l2);
  302. } else
  303. i2 = i1;
  304. comm = *line;
  305. for(i = 0, line++; isdigit(*line) ; line++)
  306. l3[i++] = *line;
  307. l3[i] = 0;
  308. i3 = _UQ_strToDec(l3);
  309. if(*line == ','){
  310. for(i = 0, line++; isdigit(*line) ; line++)
  311. l4[i++] = *line;
  312. l4[i] = 0;
  313. i4 = _UQ_strToDec(l4);
  314. } else
  315. i4 = i3;
  316. switch(comm){
  317. case 'a': /** Adding some new keys in the key file for the additions observed in the conf file */
  318. LOG("File Diff", " Something Added");
  319. for(alptr = &keylist; alptr->lineno != i1; alptr = alptr->nextline);
  320. _UQ_insertEntity(filename, alptr, i3, i4);
  321. ret = i4;
  322. break;
  323. case 'c':
  324. LOG("File Diff", "Something Changed");
  325. _UQ_reCreateKeys(filename, conffile, wbemfile, keyfile);
  326. ret = -1;
  327. goto exit;
  328. break;
  329. case 'd': /** Removing some lines from the .key file for the deletions observed in the conf file */
  330. LOG("File Diff", "Something Deleted");
  331. for(dlptr = &keylist; dlptr->lineno != i1; dlptr = dlptr->nextline)
  332. prelptr = dlptr;
  333. _UQ_deleteEntity(filename, dlptr, prelptr, i1, i2);
  334. ret = 0;
  335. break;
  336. }
  337. }
  338. fd = fopen(keyfile, "w");
  339. for(lptr = keylist.nextline; lptr->nextline; lptr = lptr->nextline)
  340. fprintf(fd, "%s", lptr->line);
  341. fclose(fd);
  342. fconf = fopen(conffile, "r");
  343. fwbem = fopen(wbemfile, "w");
  344. LOG("Coping", conffile);
  345. while( (read = getline(&line, &len, fconf)) != -1){
  346. fprintf(fwbem, line);
  347. if(line)
  348. free(line);
  349. line = NULL;
  350. }
  351. LOG("Copied into", wbemfile);
  352. if(line)
  353. free(line);
  354. fclose(fconf);
  355. fclose(fwbem);
  356. exit:
  357. _UQ_delLinkedList(keylist.nextline);
  358. _UQ_delLinkedList(tmplist.nextline);
  359. LOG("updateToDate", "Exit");
  360. return ret;
  361. }
  362. /** A method to get the key stored in the lineno line of the .key file */
  363. unsigned long long _UQ_getKeyFromData(char * file, int lineno)
  364. {
  365. char * linebuf = NULL;
  366. size_t len = 0;
  367. ssize_t read __attribute__((__unused__)) = 0;
  368. FILE * fd = NULL;
  369. unsigned long long val = 0;
  370. LOG("getKeyFromData", "Entered");
  371. if(lineno <= 0)
  372. return 0;
  373. fd = fopen(file, "r");
  374. if(fd == NULL)
  375. return 0;
  376. while(lineno--)
  377. read = getline(&linebuf, &len, fd);
  378. fclose(fd);
  379. val = _UQ_strToHex(linebuf);
  380. if(linebuf)
  381. free(linebuf);
  382. LOG("getKeyFromData", "Exit");
  383. return val;
  384. }
  385. /** The primary routine that serves as the wrapper routine that are called from outside */
  386. int getUniqueKey(char * filepath, int lineno, unsigned long long * uniqueKey)
  387. {
  388. char * filename, wbemname[100], keyname[100], tmpfile[100];
  389. int status, i, ret = 0;
  390. pid_t pId;
  391. LOG("getUniqueKey", "Entered");
  392. if(lineno <= 0)
  393. return 0;
  394. /** if the said directory does not exist, create one - access() checks the users permissions for the specified file */
  395. if(access(SYSCONFDIR "/UniqueKey",F_OK))
  396. mkdir(SYSCONFDIR "/UniqueKey", 0777);
  397. filename = _UQ_extractServiceName(filepath); /** derive the filename */
  398. sprintf( wbemname,SYSCONFDIR "/UniqueKey/.%s.wbem",filename); /** create the names of the files preceeding with a . */
  399. sprintf( keyname,SYSCONFDIR "/UniqueKey/.%s.key",filename);
  400. sprintf(tmpfile,SYSCONFDIR "/UniqueKey/.%s.tmp",filename);
  401. if( access(filepath, R_OK)) /** check the users permissions to read the conf file */
  402. return -1;
  403. if(access(wbemname, W_OK) && access(keyname, W_OK)) /** check for users permissions to open the specified files in write mode */
  404. {
  405. _UQ_setupFiles(filepath, filename, wbemname, keyname); /** copy the detais necessary to the files
  406. copy of conf file in wbemname file and
  407. keyvalues in the keyname file */
  408. }
  409. else
  410. {
  411. struct stat buf;
  412. pId = fork();
  413. if(pId)
  414. {
  415. LOG("getUniqueKey", "Forked - in the parent process");
  416. wait(&status);
  417. }
  418. else
  419. {
  420. LOG("getUniqueKey", "Forked - in the child process");
  421. for (i=getdtablesize();i>=0;--i) /** close all the opened files for this process */
  422. close(i);
  423. i=open(tmpfile, O_RDWR|O_CREAT|O_TRUNC, 0600);
  424. i = dup(i);
  425. execlp("diff","diff", wbemname, filepath,(char *) 0); /** check if there exists any differences
  426. between the copy of the config file and the
  427. orignal config file */
  428. close(i);
  429. LOG("getUniquekey", "Submitted the file difference");
  430. }
  431. stat(tmpfile, &buf); /** check the status of the file to verify if any differences were found */
  432. /** if differences were found, update the wbemname and keyname file to
  433. reflect the changes */
  434. if(buf.st_size){
  435. LOG("getUniqueKey", "Found Some diff in files");
  436. ret = _UQ_upToDate(filename, filepath, wbemname, keyname, tmpfile, filename);
  437. }
  438. }
  439. free(filename);
  440. (*uniqueKey) = _UQ_getKeyFromData(keyname, lineno); /** arrive at the key for the specified line */
  441. LOG("getUniqueKey", "Exit");
  442. return ret;
  443. }
  444. /** A wrapper routine that forms an array out of the .key file and returns the array */
  445. unsigned long long * getAllUniqueKey(char * filepath)
  446. {
  447. unsigned long long hashId, * hashIdArray;
  448. int fsize = 0;
  449. char * linebuf = NULL, * filename = NULL, keyfile[100];
  450. struct stat fileStat;
  451. FILE * fileD = NULL;
  452. size_t len = 0;
  453. ssize_t read = 0;
  454. LOG("getAllUniqueKey", "Entered");
  455. getUniqueKey(filepath, 1, &hashId);
  456. filename = _UQ_extractServiceName(filepath); /** get the conf file name */
  457. sprintf( keyfile,SYSCONFDIR "/UniqueKey/.%s.key",filename); /** create the keyfile depending on the conf file name */
  458. stat(keyfile, &fileStat); /** get the status and size of keyfile */
  459. fsize = (int)fileStat.st_size;
  460. hashIdArray = (unsigned long long *)calloc((fsize/17 + 5), sizeof(unsigned long long));
  461. fileD = fopen(keyfile, "r");
  462. if(keyfile == NULL)
  463. return NULL;
  464. for(fsize = 0; ((read = getline(&linebuf, &len, fileD)) != -1); fsize++)
  465. hashIdArray[fsize] = _UQ_strToHex(linebuf); /** prepare the hexstring and add it to the hashIdArray */
  466. LOG("getAllUniqueKey", "Prepared the hash table");
  467. fclose(fileD);
  468. if(linebuf)
  469. free(linebuf);
  470. free(filename);
  471. return hashIdArray;
  472. }
  473. /** A method invoked when the modification done to the conf file was through the provider code */
  474. void modifiedEntity(char * filePath)
  475. {
  476. char * filename, wbemname[100], *line = NULL;
  477. FILE * fconf = NULL, * fwbem = NULL;
  478. size_t len;
  479. ssize_t read;
  480. LOG("modifEntity", "Entered");
  481. filename = _UQ_extractServiceName(filePath); /** get the conf file name from the path */
  482. sprintf( wbemname,SYSCONFDIR "/UniqueKey/.%s.wbem",filename); /** prepare the wbemname to retain a copy of the conf file */
  483. fconf = fopen(filePath, "r"); /** open conf file in read and wbemname file in write mode */
  484. fwbem = fopen(wbemname, "w");
  485. /** copy the entire contents of the conf file into the wbemname file */
  486. while( (read = getline(&line, &len, fconf)) != -1){
  487. fprintf(fwbem, line);
  488. if(line)
  489. free(line);
  490. line = NULL;
  491. }
  492. fclose(fwbem); /** close both conf and wbemname files */
  493. fclose(fconf);
  494. if(line)
  495. free(line); /** free all memory allocated */
  496. free(filename);
  497. LOG("modifyEntity", "Exit");
  498. }
  499. /** method invoked when anything is added to the conf file */
  500. int addedEntity(char * filePath)
  501. {
  502. unsigned long long key;
  503. LOG("addEntity", "Entered");
  504. return getUniqueKey(filePath, 1, &key);
  505. }
  506. /** Method invoked when anything is deleted from the conf file */
  507. void deletedEntity(char * filePath)
  508. {
  509. unsigned long long key;
  510. LOG("deleteEntity", "Entered");
  511. getUniqueKey(filePath, 1, &key);
  512. }
  513. /** Method to remove all the files created for the purpose of supporting the hashing mechanism */
  514. /** Used in cleanup routine */
  515. void resetFileData(char * filePath)
  516. {
  517. char *filename, wbemfile[50], tmpfile[50], keyfile[50], idfile[50];
  518. LOG("resetFileData", "Entered");
  519. filename = _UQ_extractServiceName(filePath); /** arrive at the filename of the service conf file
  520. set the respective file names of files created to support hashing
  521. delete all the files created */
  522. sprintf( wbemfile,SYSCONFDIR "/UniqueKey/.%s.wbem",filename);
  523. sprintf( keyfile,SYSCONFDIR "/UniqueKey/.%s.key",filename);
  524. sprintf( tmpfile,SYSCONFDIR "/UniqueKey/.%s.tmp",filename);
  525. sprintf( idfile, SYSCONFDIR "/UniqueKey/.%s.Id", filename);
  526. free(filename);
  527. remove(wbemfile);
  528. remove(tmpfile);
  529. remove(keyfile);
  530. remove(idfile);
  531. }
  532. /** A dummy wrapper routine that can be called to initialise the files used for a particular conf file */
  533. void setFileData(char * filePath)
  534. {
  535. unsigned long long key;
  536. LOG("SetFileData", "Entered");
  537. getUniqueKey(filePath, 1, &key);
  538. }