• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

OpengateM Source Repository


Commit MetaInfo

Révision90b3f43589db62143428fee75c315eec5d7b7fb0 (tree)
l'heure2014-09-29 12:28:36
Auteurwatanaby <watanaby@user...>
Commiterwatanaby

Message de Log

changed strncat to strlcat

Change Summary

Modification

--- a/mdsrc/getparam.c
+++ b/mdsrc/getparam.c
@@ -68,8 +68,8 @@ int openConfFile(void)
6868
6969 /* as the syslog is not prepared, error is send to web*/
7070 strlcpy(buff, "<H3>Error: Opengate configuration file ",BUFFMAXLN);
71- strncat(buff, CONFIGFILE,BUFFMAXLN);
72- strncat(buff, " is not found. Call the administrator.</H3><BR>",BUFFMAXLN);
71+ strlcat(buff, CONFIGFILE,BUFFMAXLN);
72+ strlcat(buff, " is not found. Call the administrator.</H3><BR>",BUFFMAXLN);
7373 PutMessageToClient(buff);
7474
7575 return -1;
@@ -84,11 +84,11 @@ int openConfFile(void)
8484 if(*errMsg!='\0'){
8585 /* as the syslog is not prepared, error is send to web*/
8686 strlcpy(buff, "<H3>Error: Opengate configuration file ",BUFFMAXLN);
87- strncat(buff, CONFIGFILE,BUFFMAXLN);
88- strncat(buff, " is illegal. Call the administrator.</H3><HR>",BUFFMAXLN);
89- strncat(buff, "XML parser message: ", BUFFMAXLN);
90- strncat(buff, errMsg, BUFFMAXLN);
91- strncat(buff, "<HR>", BUFFMAXLN);
87+ strlcat(buff, CONFIGFILE,BUFFMAXLN);
88+ strlcat(buff, " is illegal. Call the administrator.</H3><HR>",BUFFMAXLN);
89+ strlcat(buff, "XML parser message: ", BUFFMAXLN);
90+ strlcat(buff, errMsg, BUFFMAXLN);
91+ strlcat(buff, "<HR>", BUFFMAXLN);
9292 PutMessageToClient(buff);
9393
9494 return -1;
@@ -98,10 +98,10 @@ int openConfFile(void)
9898 if(isNull(ezxml_attr(xmlRoot, "ConfigVersion"))||
9999 (strcmp(CONFIG_VERSION, ezxml_attr(xmlRoot, "ConfigVersion"))!=0)){
100100 strlcpy(buff, "<H3>Error: Opengate configuration file ",BUFFMAXLN);
101- strncat(buff, CONFIGFILE, BUFFMAXLN);
102- strncat(buff, " has mismatch version.<br> Please update it with ",BUFFMAXLN);
103- strncat(buff, CONFIGFILE, BUFFMAXLN);
104- strncat(buff, ".sample.",BUFFMAXLN);
101+ strlcat(buff, CONFIGFILE, BUFFMAXLN);
102+ strlcat(buff, " has mismatch version.<br> Please update it with ",BUFFMAXLN);
103+ strlcat(buff, CONFIGFILE, BUFFMAXLN);
104+ strlcat(buff, ".sample.",BUFFMAXLN);
105105 PutMessageToClient(buff);
106106
107107 return -1;
@@ -113,8 +113,8 @@ int openConfFile(void)
113113
114114 /* as the syslog is not prepared, error is send to web*/
115115 strlcpy(buff, "<H3>Error: correct SYSLOG setting(local0-local7) is not found in Opengate configuration file ",BUFFMAXLN);
116- strncat(buff, CONFIGFILE,BUFFMAXLN);
117- strncat(buff, ". Call the administrator.</H3><BR>",BUFFMAXLN);
116+ strlcat(buff, CONFIGFILE,BUFFMAXLN);
117+ strlcat(buff, ". Call the administrator.</H3><BR>",BUFFMAXLN);
118118 PutMessageToClient(buff);
119119
120120 return -1;
--- a/mdsrc/ipfw.c
+++ b/mdsrc/ipfw.c
@@ -46,8 +46,8 @@ int openClientGate(char *macAddress, char* userId, char* extraId)
4646 /* prepare userid-long as [userid@extraid] */
4747 strlcpy(userIdLong, userId, WORDMAXLN);
4848 if(!isNull(extraId)){
49- strncat(userIdLong, "@", WORDMAXLN);
50- strncat(userIdLong, extraId, WORDMAXLN);
49+ strlcat(userIdLong, "@", WORDMAXLN);
50+ strlcat(userIdLong, extraId, WORDMAXLN);
5151 }
5252
5353 /* exclusive exec of ipfw to avoid overlapped rule number */
--- a/mdsrc/util.c
+++ b/mdsrc/util.c
@@ -87,7 +87,7 @@ FILE *Popenl(int rootPriv, const char *type, const char *path, ...)
8787
8888 while((pStr=va_arg(ap, char *))!=(char *)0){
8989 strcat(commandLine, " ");
90- strncat(commandLine, pStr, BUFFMAXLN);
90+ strlcat(commandLine, pStr, BUFFMAXLN);
9191 }
9292 free(pStr);
9393 va_end(ap);
@@ -135,7 +135,7 @@ int Systeml(int rootPriv, const char *path, ...)
135135
136136 while((pStr=va_arg(ap, char *))!=(char *)0){
137137 strcat(commandLine, " ");
138- strncat(commandLine, pStr, BUFFMAXLN);
138+ strlcat(commandLine, pStr, BUFFMAXLN);
139139 }
140140 free(pStr);
141141 va_end(ap);
--- a/mngsrc/auth-ldap.c
+++ b/mngsrc/auth-ldap.c
@@ -86,8 +86,8 @@ int authLdap(char *userid, char *passwd)
8686
8787 /* set filter */
8888 strlcpy(filter, "(uid=", BUFFMAXLN);
89- strncat(filter, userid, BUFFMAXLN);
90- strncat(filter, ")", BUFFMAXLN);
89+ strlcat(filter, userid, BUFFMAXLN);
90+ strlcat(filter, ")", BUFFMAXLN);
9191
9292 /* search LDAP entry */
9393 ret = ldap_search_ext_s(ld,baseDn,LDAP_SCOPE_SUBTREE,
--- a/mngsrc/auth.c
+++ b/mngsrc/auth.c
@@ -199,8 +199,8 @@ int isUserIdFoundInAcceptUsersList(char* userId){
199199 /* meaning is [(head or space) userid-string (space or tail)] */
200200 /* last-arg 0 of RegEx means ignore-case */
201201 strlcpy(userIdPattern, "(^| )", WORDMAXLN);
202- strncat(userIdPattern, userId, WORDMAXLN);
203- strncat(userIdPattern, "( |$)", WORDMAXLN);
202+ strlcat(userIdPattern, userId, WORDMAXLN);
203+ strlcat(userIdPattern, "( |$)", WORDMAXLN);
204204 return RegExMatch(usersList, userIdPattern, 0);
205205 }
206206
@@ -320,8 +320,8 @@ char* concatUserId(char* useridfull, char* userId, char* extraId){
320320 /* set full userid */
321321 strlcpy(useridfull, userId,USERMAXLN);
322322 if(!isNull(extraId)){
323- strncat(useridfull, GetConfValue("UserIdSeparator"), USERMAXLN);
324- strncat(useridfull, extraId, USERMAXLN);
323+ strlcat(useridfull, GetConfValue("UserIdSeparator"), USERMAXLN);
324+ strlcat(useridfull, extraId, USERMAXLN);
325325 }
326326 return useridfull;
327327 }
@@ -572,8 +572,8 @@ int makeMailDefault(char* userId, char* extraId, char* mailDefault){
572572 /* if set mail domain, mail from userid+@+maildomain */
573573 if(!isNull(pMailDomain)){
574574 strlcpy(mailDefault, userId, BUFFMAXLN);
575- strncat(mailDefault, "@", BUFFMAXLN);
576- strncat(mailDefault, pMailDomain, BUFFMAXLN);
575+ strlcat(mailDefault, "@", BUFFMAXLN);
576+ strlcat(mailDefault, pMailDomain, BUFFMAXLN);
577577 return TRUE;
578578 }else{
579579 err_msg("ERR at %s#%d: Can't get mail domain string from conf file.",__FILE__,__LINE__);
--- a/mngsrc/cgi.c
+++ b/mngsrc/cgi.c
@@ -180,8 +180,8 @@ int getUserIdFromEnv(char *userid){
180180 /* if orp string can be get from env var, concatenate it as uid@org */
181181 pEnv=getenvEx(GetConfValue("AuthServer/OrgAttribute"),TRUE,TRUE);
182182 if(!isNull(pEnv)){
183- strncat(userid, GetConfValue("UserIdSeparator"), USERMAXLN);
184- strncat(userid, pEnv, USERMAXLN);
183+ strlcat(userid, GetConfValue("UserIdSeparator"), USERMAXLN);
184+ strlcat(userid, pEnv, USERMAXLN);
185185 }
186186 ret=TRUE;
187187 }
@@ -190,7 +190,7 @@ int getUserIdFromEnv(char *userid){
190190 else{
191191 pEnv=getenvEx(GetConfValue("AuthServer/EppnAttribute"),TRUE,FALSE);
192192 if(!isNull(pEnv)){
193- strncat(userid, pEnv, USERMAXLN);
193+ strlcat(userid, pEnv, USERMAXLN);
194194 ret=TRUE;
195195 }
196196 }
@@ -840,10 +840,10 @@ int htmlReplace(char* buff,char *beforeStr,char *afterStr)
840840 for(pBuff = tempBuff;
841841 (pNext=StrSplit(pBuff, beforeStr)) != NULL;
842842 pBuff = pNext){
843- strncat(buff,pBuff,BUFFMAXLN);
844- strncat(buff,afterStr,BUFFMAXLN);
843+ strlcat(buff,pBuff,BUFFMAXLN);
844+ strlcat(buff,afterStr,BUFFMAXLN);
845845 }
846- strncat(buff,pBuff,BUFFMAXLN);
846+ strlcat(buff,pBuff,BUFFMAXLN);
847847
848848 return 0;
849849 }
--- a/mngsrc/getparam.c
+++ b/mngsrc/getparam.c
@@ -59,8 +59,8 @@ int openConfFile(void)
5959
6060 /* as the syslog is not prepared, error is send to web*/
6161 strlcpy(buff, "<H3>Error: Opengate configuration file ",BUFFMAXLN);
62- strncat(buff, CONFIGFILE,BUFFMAXLN);
63- strncat(buff, " is not found. Call the administrator.</H3><BR>",BUFFMAXLN);
62+ strlcat(buff, CONFIGFILE,BUFFMAXLN);
63+ strlcat(buff, " is not found. Call the administrator.</H3><BR>",BUFFMAXLN);
6464 PutMessageToClient(buff);
6565
6666 return -1;
@@ -75,11 +75,11 @@ int openConfFile(void)
7575 if(*errMsg!='\0'){
7676 /* as the syslog is not prepared, error is send to web*/
7777 strlcpy(buff, "<H3>Error: Opengate configuration file ",BUFFMAXLN);
78- strncat(buff, CONFIGFILE,BUFFMAXLN);
79- strncat(buff, " is illegal. Call the administrator.</H3><HR>",BUFFMAXLN);
80- strncat(buff, "XML parser message: ", BUFFMAXLN);
81- strncat(buff, errMsg, BUFFMAXLN);
82- strncat(buff, "<HR>", BUFFMAXLN);
78+ strlcat(buff, CONFIGFILE,BUFFMAXLN);
79+ strlcat(buff, " is illegal. Call the administrator.</H3><HR>",BUFFMAXLN);
80+ strlcat(buff, "XML parser message: ", BUFFMAXLN);
81+ strlcat(buff, errMsg, BUFFMAXLN);
82+ strlcat(buff, "<HR>", BUFFMAXLN);
8383 PutMessageToClient(buff);
8484
8585 return -1;
@@ -89,10 +89,10 @@ int openConfFile(void)
8989 if(isNull(ezxml_attr(xmlRoot, "ConfigVersion"))||
9090 (strcmp(CONFIG_VERSION, ezxml_attr(xmlRoot, "ConfigVersion"))!=0)){
9191 strlcpy(buff, "<H3>Error: Opengate configuration file ",BUFFMAXLN);
92- strncat(buff, CONFIGFILE, BUFFMAXLN);
93- strncat(buff, " has mismatch version.<br> Please update it with ",BUFFMAXLN);
94- strncat(buff, CONFIGFILE, BUFFMAXLN);
95- strncat(buff, ".sample.",BUFFMAXLN);
92+ strlcat(buff, CONFIGFILE, BUFFMAXLN);
93+ strlcat(buff, " has mismatch version.<br> Please update it with ",BUFFMAXLN);
94+ strlcat(buff, CONFIGFILE, BUFFMAXLN);
95+ strlcat(buff, ".sample.",BUFFMAXLN);
9696 PutMessageToClient(buff);
9797
9898 return -1;
@@ -104,8 +104,8 @@ int openConfFile(void)
104104
105105 /* as the syslog is not prepared, error is send to web*/
106106 strlcpy(buff, "<H3>Error: correct SYSLOG setting(local0-local7) is not found in Opengate configuration file ",BUFFMAXLN);
107- strncat(buff, CONFIGFILE,BUFFMAXLN);
108- strncat(buff, ". Call the administrator.</H3><BR>",BUFFMAXLN);
107+ strlcat(buff, CONFIGFILE,BUFFMAXLN);
108+ strlcat(buff, ". Call the administrator.</H3><BR>",BUFFMAXLN);
109109 PutMessageToClient(buff);
110110
111111 return -1;
--- a/mngsrc/ipfw.c
+++ b/mngsrc/ipfw.c
@@ -47,8 +47,8 @@ int openClientGate(char *clientAddr, int forced, char* userId, char* extraId, ch
4747 /* prepare userid-long as [userid@extraid] */
4848 strlcpy(userIdLong, userId, WORDMAXLN);
4949 if(!isNull(extraId)){
50- strncat(userIdLong, "@", WORDMAXLN);
51- strncat(userIdLong, extraId, WORDMAXLN);
50+ strlcat(userIdLong, "@", WORDMAXLN);
51+ strlcat(userIdLong, extraId, WORDMAXLN);
5252 }
5353
5454 /* exclusive exec of ipfw to avoid overlapped rule number */
--- a/mngsrc/opengatemmail.c
+++ b/mngsrc/opengatemmail.c
@@ -108,8 +108,8 @@ int sendMail(char* mailAddress, char* limitDate, char* device)
108108
109109 /* prepare mail command [/bin/rmail user@domain] */
110110 strlcpy(mailCmd, mailCmdPath, BUFFMAXLN);
111- strncat(mailCmd, " ", BUFFMAXLN);
112- strncat(mailCmd, mailAddress, BUFFMAXLN);
111+ strlcat(mailCmd, " ", BUFFMAXLN);
112+ strlcat(mailCmd, mailAddress, BUFFMAXLN);
113113
114114 /* prepare a pipe connected to the mail command */
115115 mailer = popen(mailCmd, "w");
--- a/mngsrc/util.c
+++ b/mngsrc/util.c
@@ -216,7 +216,7 @@ FILE *Popenl(int rootPriv, const char *type, const char *path, ...)
216216
217217 while((pStr=va_arg(ap, char *))!=(char *)0){
218218 strcat(commandLine, " ");
219- strncat(commandLine, pStr, BUFFMAXLN);
219+ strlcat(commandLine, pStr, BUFFMAXLN);
220220 }
221221 free(pStr);
222222 va_end(ap);
@@ -264,7 +264,7 @@ int Systeml(int rootPriv, const char *path, ...)
264264
265265 while((pStr=va_arg(ap, char *))!=(char *)0){
266266 strcat(commandLine, " ");
267- strncat(commandLine, pStr, BUFFMAXLN);
267+ strlcat(commandLine, pStr, BUFFMAXLN);
268268 }
269269 free(pStr);
270270 va_end(ap);