1 /**************************************************
2 OpengateM - MAC address authentication system
4 module to control management database
9 Copyright (C) 2011 Opengate Project Team
10 Written by Yoshiaki Watanabe
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License
14 as published by the Free Software Foundation; either version 2
15 of the License, or (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 Email: watanaby@is.saga-u.ac.jp
27 **************************************************/
28 #include "opengatemmng.h"
33 /******************************************
34 initialize management db
35 ******************************************/
39 char *server = GetConfValue("MySqlDb/Server");
40 char *user = GetConfValue("MySqlDb/User");
41 char *password = GetConfValue("MySqlDb/Password");
42 char *database = GetConfValue("MySqlDb/Database");
45 /* initialize mysql */
46 mysql_library_init(-1,NULL,NULL);
47 if(mysql_init(&mysql)==NULL){
48 err_msg("ERR at %s#%d: mysql init: %s",__FILE__,__LINE__,
53 /* Connect to database */
54 if (!mysql_real_connect(&mysql, server,
55 user, password, database, 0, NULL, 0)) {
56 err_msg("ERR at %s#%d: mysql connect: %s",__FILE__,__LINE__,
61 /* set auto-reconnect true */
63 mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect);
68 /******************************************
70 ******************************************/
71 void closeMngDb(void){
77 /******************************************
78 get nic vendor from management db
79 ******************************************/
80 int getNicVendorFromMngDb(char* macAddress, char* vendor, int bufferLength){
85 char queryStr[BUFFMAXLN];
86 char macHeader[ADDRMAXLN];
88 /* set default values */
92 /* prepare query string */
93 strlcpy(macHeader, macAddress, ADDRMAXLN);
95 snprintf(queryStr, BUFFMAXLN,
96 "select org from nicvendors where oui='%s'",
100 if (mysql_query(&mysql, queryStr)){
101 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
102 mysql_error(&mysql));
106 res = mysql_use_result(&mysql);
108 /* output table name */
109 row = mysql_fetch_row(res);
111 /* if not found, return false */
112 if(row==NULL) found=FALSE;
116 strlcpy(vendor, row[0], bufferLength);
120 mysql_free_result(res);
124 /******************************************
125 The macAddr is already registered
126 ******************************************/
127 int isMacAddrFoundInMngDb(char* macAddr){
131 char queryStr[BUFFMAXLN];
134 /* prepare query string */
135 snprintf(queryStr, BUFFMAXLN,
136 "select * from macaddrs "
137 " where macAddress='%s' and status!='D'",
141 if (mysql_query(&mysql, queryStr)){
142 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
143 mysql_error(&mysql));
148 res = mysql_store_result(&mysql);
150 /* output table name */
151 row = mysql_fetch_row(res);
153 /* if found, return true */
154 if(row!=NULL) ret=TRUE;
156 /* if not found, return false */
159 mysql_free_result(res);
163 /******************************************
164 The count of registered mac address for the user
165 ******************************************/
166 int countMacAddrsForUserInMngDb(char* userId, char* extraId){
170 char queryStr[BUFFMAXLN];
171 char countStr[WORDMAXLN];
174 /* prepare query string */
175 snprintf(queryStr, BUFFMAXLN,
176 "select count(*) from macaddrs "
177 " where userId='%s' and extraId='%s' and status!='D'",
181 if (mysql_query(&mysql, queryStr)){
182 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
183 mysql_error(&mysql));
188 res = mysql_store_result(&mysql);
190 /* output table name */
191 row = mysql_fetch_row(res);
193 /* if found, return values */
195 strlcpy(countStr, row[0], WORDMAXLN);
196 count=atoi(countStr);
199 /* free memory area */
200 mysql_free_result(res);
205 /******************************************
206 register mac address to the management db
207 ******************************************/
208 int registMacAddrToMngDb(char* macAddr, char* deviceName, char* userId, char* extraId, char* mailAddr){
210 char queryStr[BUFFMAXLN];
213 /* if alreay registered (and not deleted yet), return false */
214 if(IsMacAddrFoundInMngDb(macAddr)){
215 SetMessage(ExistentMacAddr);
219 /* if the user registered device more than limit, return false */
220 count=CountMacAddrsForUserInMngDb(userId,extraId);
221 if(count >= atoi(GetConfValue("MaxDevices"))){
222 SetMessage(DeviceCountOver);
226 /* prepare query string */
227 snprintf(queryStr, BUFFMAXLN,
228 "insert into macaddrs "
229 "(macAddress, status, device, userId, extraId, "
230 " entryDate, renewDate, limitDate, mailAddress) "
231 "values ('%s','A','%s', '%s', '%s', "
232 " now(), now(), %s, '%s')",
233 macAddr, deviceName, userId, extraId,
234 GetConfValue("LimitDate"), mailAddr);
237 if (mysql_query(&mysql, queryStr)){
238 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
239 mysql_error(&mysql));
246 /*******************************************
247 get next mac address from management db
248 if end of list, return false
249 *******************************************/
250 int getNextMacAddrFromMngDb(char* userId, char* extraId, char* macAddress, char* deviceName, char* entryDate, char* limitDate, char* status, char* mailAddress){
252 static MYSQL_RES *res=NULL;
254 char queryStr[BUFFMAXLN];
256 /* set default values */
257 macAddress[0]=deviceName[0]=entryDate[0]=limitDate[0]='\0';
259 /* if do not get result yet */
262 /* prepare query string */
263 snprintf(queryStr, BUFFMAXLN,
264 "select macAddress, device, entryDate, limitDate, status, mailAddress "
265 "from macaddrs where userId='%s' and extraId='%s' and status!='D'",
269 if (mysql_query(&mysql, queryStr)){
270 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
271 mysql_error(&mysql));
276 res = mysql_store_result(&mysql);
279 /* output table name */
280 row = mysql_fetch_row(res);
282 /* if found, return values */
284 strlcpy(macAddress, row[0],ADDRMAXLN);
285 strlcpy(deviceName,row[1],WORDMAXLN);
286 strlcpy(entryDate,row[2],WORDMAXLN);
287 strlcpy(limitDate,row[3],WORDMAXLN);
288 strlcpy(status,row[4],WORDMAXLN);
289 strlcpy(mailAddress,row[5],BUFFMAXLN);
292 /* if not found, free memory area */
294 mysql_free_result(res);
300 /******************************************
301 write mac modification log to the management db
302 ******************************************/
303 int putMacModifyLogToMngDb(char* userId, char* extraId, char* macAddr, char modifyType){
305 char queryStr[BUFFMAXLN];
307 /* prepare query string */
308 snprintf(queryStr, BUFFMAXLN,
309 "insert into macmodify "
310 "(userId, extraId, macAddress, modifyType, modifyDate) "
311 "values ('%s', '%s', '%s', '%c', now())",
312 userId, extraId, macAddr, modifyType);
315 if (mysql_query(&mysql, queryStr)){
316 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
317 mysql_error(&mysql));
324 /******************************************
325 The count of mac address modification in last 24 hours
326 ******************************************/
327 int countMacModifyPerDayInMngDb(char* userId, char* extraId){
331 char queryStr[BUFFMAXLN];
332 char countStr[WORDMAXLN];
335 /* prepare query string */
336 snprintf(queryStr, BUFFMAXLN,
337 "select count(*) from macmodify "
338 " where userId='%s' and extraId='%s' and "
339 " modifyDate > adddate(now(), interval -1 day) ",
343 if (mysql_query(&mysql, queryStr)){
344 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
345 mysql_error(&mysql));
350 res = mysql_store_result(&mysql);
352 /* output table name */
353 row = mysql_fetch_row(res);
355 /* if found, return values */
357 strlcpy(countStr, row[0], WORDMAXLN);
358 count=atoi(countStr);
361 /* free memory area */
362 mysql_free_result(res);
367 /******************************************
368 delete a mac address registered in the management db
369 do not delete, but set the status flag to 'D'
370 ******************************************/
371 int delMacAddrFromMngDb(char* macAddr){
373 char queryStr[BUFFMAXLN];
375 /* if the mac data was used, it is preserved for usage log */
376 if(IsSessionFoundInMngDb(macAddr)){
378 /* prepare query string */
379 /* if session for the mac exists, the row is preserved */
380 /* don't touch device set as status=Inactive */
381 snprintf(queryStr, BUFFMAXLN,
382 "update macaddrs set status='D',limitDate=now() "
383 " where macAddress='%s' and (status='A' or status='P')", macAddr);
386 /* prepare query string */
387 /* if session does not exist, the row is removed */
388 /* don't touch device set as status=Inactive */
389 snprintf(queryStr, BUFFMAXLN,
390 "delete from macaddrs "
391 " where macAddress='%s' and (status='A' or status='P')", macAddr);
395 if (mysql_query(&mysql, queryStr)){
396 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
397 mysql_error(&mysql));
403 /******************************************
404 renew the limit date for a mac address
405 registered in the management db
406 ******************************************/
407 int renewMacAddrInMngDb(char* macAddr){
409 char queryStr[BUFFMAXLN];
411 /* prepare query string */
412 /* don't touch device set as inactive by admin */
413 snprintf(queryStr, BUFFMAXLN,
414 "update macaddrs set status='A', renewDate=now(), limitDate=%s "
415 " where (status='A' or status='P') and macAddress='%s'",
416 GetConfValue("LimitDate"),macAddr);
419 if (mysql_query(&mysql, queryStr)){
420 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
421 mysql_error(&mysql));
427 /******************************************
428 pause the usage of the device for a mac address
429 registered in the management db
430 ******************************************/
431 int pauseMacAddrInMngDb(char* macAddr){
433 char queryStr[BUFFMAXLN];
435 /* prepare query string */
436 /* don't touch device set as inactive by admin */
437 snprintf(queryStr, BUFFMAXLN,
438 "update macaddrs set status='P' "
439 " where status='A' and macAddress='%s' and limitDate>now()",
443 if (mysql_query(&mysql, queryStr)){
444 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
445 mysql_error(&mysql));
451 /******************************************
452 is the mac address used in session log
453 ******************************************/
454 int isSessionFoundInMngDb(char* macAddr){
458 char queryStr[BUFFMAXLN];
461 /* prepare query string */
462 /* get row for addr.entry<session.open<addr.limit */
463 snprintf(queryStr, BUFFMAXLN,
464 "select * from macaddrs, sessionmd "
465 " where macaddrs.macAddress=sessionmd.macAddress and "
466 " macaddrs.macAddress='%s' and "
467 " entryDate<openTime and openTime<limitDate",
471 if (mysql_query(&mysql, queryStr)){
472 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
473 mysql_error(&mysql));
478 res = mysql_store_result(&mysql);
480 /* output table name */
481 row = mysql_fetch_row(res);
483 /* if found, return true */
484 if(row!=NULL) ret=TRUE;
486 /* if not found, return false */
489 mysql_free_result(res);
493 /*******************************************
494 get next next usage log from management db
495 if end of list, return false
496 *******************************************/
497 int getNextUsageLogFromMngDb(char* userId, char* extraId, char* macAddr, char* deviceName, char* openTime, char* closeTime, char* gatewayName){
498 static MYSQL_RES *res=NULL;
500 char queryStr[BUFFMAXLN];
502 /* set default values */
503 macAddr[0]=deviceName[0]=openTime[0]=gatewayName[0]='\0';
505 /* if do not get result yet */
508 /* prepare query string */
509 /* get log where addr.entry < session.open < addr.limit */
510 /* (the same device may be registered by other users in old days) */
511 snprintf(queryStr, BUFFMAXLN,
512 "select macaddrs.macAddress, device, openTime, closeTime, "
514 " from macaddrs, sessionmd "
515 " where macaddrs.macAddress=sessionmd.macAddress "
516 " and entryDate < openTime and openTime < limitDate "
517 " and (%s<closeTime or closeTime=0) "
518 " and userId='%s' and extraId='%s'",
519 GetConfValue("ShowLogAfter"), userId, extraId);
522 if (mysql_query(&mysql, queryStr)){
523 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
524 mysql_error(&mysql));
529 res = mysql_store_result(&mysql);
532 /* output table name */
533 row = mysql_fetch_row(res);
535 /* if found, return values */
537 strlcpy(macAddr, row[0],ADDRMAXLN);
538 strlcpy(deviceName,row[1],WORDMAXLN);
539 strlcpy(openTime,row[2],WORDMAXLN);
540 strlcpy(closeTime,row[3],WORDMAXLN);
541 strlcpy(gatewayName,row[4],WORDMAXLN);
544 /* if not found, free memory area */
546 mysql_free_result(res);
552 /*******************************************
553 get next mail address near limit date
555 *******************************************/
556 int getNextMailAddressFromMngDb(char* mailAddress, char* limitDate, char* device){
558 static MYSQL_RES *res=NULL;
560 char queryStr[BUFFMAXLN];
561 char* mailTiming=NULL;
563 /* set default values */
564 mailAddress[0]=limitDate[0]='\0';
566 /* if do not get result yet */
569 /* get mail send timing from conf file */
570 mailTiming = GetConfValue("Mail/Timing");
571 if(isNull(mailTiming)) return FALSE;
573 /* prepare query string */
574 /* [select mailAddress,limitDate,device from macaddrs
575 where ( date(now())=date(adddate(limitDate, interval -1 day))
576 OR date(now())=date(adddate(limitDate, interval -7 day)) )
577 AND (status='A' OR status='P') order by mailAddress,limitDate] */
578 snprintf(queryStr, BUFFMAXLN,
579 "select mailAddress,limitDate,device from macaddrs "
580 " where (%s) and (status='A' or status='P') "
581 " order by mailAddress,limitDate", mailTiming);
582 /* mailTiming is a condition string defined in conf file */
585 if (mysql_query(&mysql, queryStr)){
586 err_msg("ERR at %s#%d: mysql query[%s]: %s",__FILE__,__LINE__,queryStr,
587 mysql_error(&mysql));
592 res = mysql_store_result(&mysql);
595 /* output table name */
596 row = mysql_fetch_row(res);
598 /* if found, return values */
600 strlcpy(mailAddress, row[0], BUFFMAXLN);
601 strlcpy(limitDate, row[1], WORDMAXLN);
602 strlcpy(device, row[2], WORDMAXLN);
605 /* if not found, free memory area */
607 mysql_free_result(res);
612 /*******************************************
613 get the date corresponding to ShowLogAfter in conf file
614 *******************************************/
615 int getTimeRangeToShowLog(char* beginTime, char* endTime, int* dateCount){
617 static MYSQL_RES *res=NULL;
619 char queryStr[BUFFMAXLN];
621 char countStr[WORDMAXLN];
623 /* get conf value for beginning day for listing */
624 showLogAfter=GetConfValue("ShowLogAfter");
625 if(isNull(showLogAfter)) return FALSE;
627 /* set default values */
632 /* if do not get result yet */
635 /* prepare query string */
636 /* select (adddate(now(), interval -1 month)),
638 datediff(now(),(adddate(now(), interval -1 month))) + 1; */
639 snprintf(queryStr, BUFFMAXLN,
640 "select (%s), now(), datediff(now(),(%s)) + 1",
641 showLogAfter, showLogAfter);
644 if (mysql_query(&mysql, queryStr)){
645 err_msg("ERR at %s#%d: mysql query[%s]: %s",__FILE__,__LINE__,queryStr,
646 mysql_error(&mysql));
651 res = mysql_store_result(&mysql);
654 /* output table name */
655 row = mysql_fetch_row(res);
657 /* if found, return values */
659 strlcpy(beginTime, row[0], WORDMAXLN);
660 strlcpy(endTime, row[1], WORDMAXLN);
661 strlcpy(countStr, row[2], WORDMAXLN);
662 *dateCount=atoi(countStr);
665 /* if not found, free memory area */
667 mysql_free_result(res);
672 /********************************************
673 rename the device name for indicated mac address
674 ********************************************/
675 int renameDeviceNameInMngDb(char* macAddr, char* nameStr){
677 char queryStr[BUFFMAXLN];
679 /* prepare query string */
680 snprintf(queryStr, BUFFMAXLN,
681 "update macaddrs set device='%s' "
682 " where (status='A' or status='P') and macAddress='%s'",
686 if (mysql_query(&mysql, queryStr)){
687 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
688 mysql_error(&mysql));
694 /********************************************
695 rename the mail address for indicated mac address
696 ********************************************/
697 int renameMailAddressInMngDb(char* macAddr, char* mailStr){
699 char queryStr[BUFFMAXLN];
701 /* prepare query string */
702 snprintf(queryStr, BUFFMAXLN,
703 "update macaddrs set mailAddress='%s' "
704 " where (status='A' or status='P') and macAddress='%s'",
708 if (mysql_query(&mysql, queryStr)){
709 err_msg("ERR at %s#%d: mysql query: %s",__FILE__,__LINE__,
710 mysql_error(&mysql));
718 /********************************************
719 routines for debugging output
720 ********************************************/
724 if(debug>1) err_msg("DEBUG:=>initMngDb()");
726 if(debug>1) err_msg("DEBUG:(%d)<=initMngDb()",ret);
729 void CloseMngDb(void){
730 if(debug>1) err_msg("DEBUG:=>closeMngDb()");
732 if(debug>1) err_msg("DEBUG:<=closeMngDb()");
735 int GetNextMacAddrFromMngDb(char* userId, char* extraId, char* macAddress, char* deviceName, char* entryDate, char* limitDate, char* status, char* mailAddress){
737 if(debug>1) err_msg("DEBUG:=>getNextMacAddrFromMngDb(%s,%s)",userId,extraId);
738 ret=getNextMacAddrFromMngDb(userId,extraId,macAddress,deviceName,
739 entryDate,limitDate, status,mailAddress);
740 if(debug>1) err_msg("DEBUG:(%d)<=getNextMacAddrFromMngDb(,,%s,%s,%s,%s,%s,%s)",
741 ret,macAddress,deviceName,entryDate,limitDate,status,mailAddress);
745 int RegistMacAddrToMngDb(char* macAddr, char* deviceName, char* userId, char* extraId, char* mailAddress){
747 if(debug>1) err_msg("DEBUG:=>registMacAddrToMngDb(%s,%s,%s,%s,%s)",
748 macAddr,deviceName,userId,extraId,mailAddress);
749 ret=registMacAddrToMngDb(macAddr,deviceName,userId,extraId, mailAddress);
750 if(debug>1) err_msg("DEBUG:(%d)<=registMacAddrToMngDb( )",ret);
754 int IsMacAddrFoundInMngDb(char* macAddr){
756 if(debug>1) err_msg("DEBUG:=>isMacAddrFoundInMngDb(%s)", macAddr);
757 ret=isMacAddrFoundInMngDb(macAddr);
758 if(debug>1) err_msg("DEBUG:(%d)<=isMacAddrFoundInMngDb( )",ret);
762 int CountMacAddrsForUserInMngDb(char* userId, char* extraId){
764 if(debug>1) err_msg("DEBUG:=>countMacAddrsForUserInMngDb(%s,%s)",
766 ret=countMacAddrsForUserInMngDb(userId,extraId);
767 if(debug>1) err_msg("DEBUG:(%d)<=countMacAddrsForUserInMngDb( )",ret);
771 int PutMacModifyLogToMngDb(char* userId, char* extraId, char* macAddr, char modifyType){
773 if(debug>1) err_msg("DEBUG:=>putMacModifyLogToMngDb(%s,%s,%s,%c)",
774 userId,extraId,macAddr,modifyType);
775 ret=putMacModifyLogToMngDb(userId,extraId,macAddr,modifyType);
776 if(debug>1) err_msg("DEBUG:(%d)<=putMacModifyLogToMngDb( )",ret);
780 int GetNicVendorFromMngDb(char* macAddress, char* vendor, int bufferLength){
782 if(debug>1) err_msg("DEBUG:=>getNicVendorFromMngDb(%s,,%d)",
783 macAddress, bufferLength);
784 ret=getNicVendorFromMngDb(macAddress, vendor, bufferLength);
785 if(debug>1) err_msg("DEBUG:(%d)<=getNicVendorFromMngDb(%s)",ret, vendor);
790 int CountMacModifyPerDayInMngDb(char* userId, char* extraId){
792 if(debug>1) err_msg("DEBUG:=>countMacModifyPerDayInMngDb(%s,%s)",
794 ret=countMacModifyPerDayInMngDb(userId,extraId);
795 if(debug>1) err_msg("DEBUG:(%d)<=countMacModifyPerDayInMngDb( )",ret);
799 int DelMacAddrFromMngDb(char* macAddr){
801 if(debug>1) err_msg("DEBUG:=>delMacAddrFromMngDb(%s)",macAddr);
802 ret=delMacAddrFromMngDb(macAddr);
803 if(debug>1) err_msg("DEBUG:(%d)<=delMacAddrFromMngDb( )",ret);
807 int RenewMacAddrInMngDb(char* macAddr){
809 if(debug>1) err_msg("DEBUG:=>renewMacAddrInMngDb(%s)",macAddr);
810 ret=renewMacAddrInMngDb(macAddr);
811 if(debug>1) err_msg("DEBUG:(%d)<=renewMacAddrinMngDb( )",ret);
815 int PauseMacAddrInMngDb(char* macAddr){
817 if(debug>1) err_msg("DEBUG:=>pauseMacAddrInMngDb(%s)",macAddr);
818 ret=pauseMacAddrInMngDb(macAddr);
819 if(debug>1) err_msg("DEBUG:(%d)<=pauseMacAddrinMngDb( )",ret);
823 int IsSessionFoundInMngDb(char* macAddr){
825 if(debug>1) err_msg("DEBUG:=>isSessionFoundInMngDb(%s)",macAddr);
826 ret=isSessionFoundInMngDb(macAddr);
827 if(debug>1) err_msg("DEBUG:(%d)<=isSessionFoundInMngDb( )",ret);
831 int GetNextUsageLogFromMngDb(char* userId, char* extraId, char* macAddr,
832 char* deviceName, char* openTime, char* closeTime, char* gatewayName){
834 if(debug>1) err_msg("DEBUG:=>getNextUsageLogFromMngDb(%s,%s)",userId,extraId);
835 ret=getNextUsageLogFromMngDb(userId,extraId,macAddr,deviceName,
836 openTime,closeTime,gatewayName);
837 if(debug>1) err_msg("DEBUG:(%d)<=getNextUsageLogFromMngDb(,,%s,%s,%s,%s,%s)",
838 ret,macAddr,deviceName,openTime,closeTime,gatewayName);
842 int GetNextMailAddressFromMngDb(char* mailAddress, char* limitDate, char*device){
844 if(debug>1) err_msg("DEBUG:=>getnextMailAddressFromMngDb( )");
845 ret=getNextMailAddressFromMngDb(mailAddress, limitDate, device);
846 if(debug>1) err_msg("DEBUG:(%d)<=getNextMailAddressFromMngDb(%s,%s,%s)",
847 ret,mailAddress,limitDate,device);
851 int GetTimeRangeToShowLog(char* beginTime, char* endTime, int* dateCount){
853 if(debug>1) err_msg("DEBUG:=>getTimeRangeToShowLog( )");
854 ret=getTimeRangeToShowLog(beginTime, endTime, dateCount);
855 if(debug>1) err_msg("DEBUG:(%d)<=getTimeRangeToShowLog(%s,%s,%d)",
856 ret,beginTime,endTime,*dateCount);
860 int RenameDeviceNameInMngDb(char* macAddr, char* nameStr){
862 if(debug>1) err_msg("DEBUG:=>renameDevideNameInMngDb(%s,%s)",macAddr,nameStr);
863 ret=renameDeviceNameInMngDb(macAddr, nameStr);
864 if(debug>1) err_msg("DEBUG:(%d)<=renameDeviceNameInMngDb()",ret);
868 int RenameMailAddressInMngDb(char* macAddr, char* mailStr){
870 if(debug>1) err_msg("DEBUG:=>renameMailAddressInMngDb(%s,%s)",macAddr,mailStr);
871 ret=renameMailAddressInMngDb(macAddr, mailStr);
872 if(debug>1) err_msg("DEBUG:(%d)<=renameMailAddressInMngDb()",ret);