OpengateM Source Repository
Révision | 90b3f43589db62143428fee75c315eec5d7b7fb0 (tree) |
---|---|
l'heure | 2014-09-29 12:28:36 |
Auteur | watanaby <watanaby@user...> |
Commiter | watanaby |
changed strncat to strlcat
@@ -68,8 +68,8 @@ int openConfFile(void) | ||
68 | 68 | |
69 | 69 | /* as the syslog is not prepared, error is send to web*/ |
70 | 70 | 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); | |
73 | 73 | PutMessageToClient(buff); |
74 | 74 | |
75 | 75 | return -1; |
@@ -84,11 +84,11 @@ int openConfFile(void) | ||
84 | 84 | if(*errMsg!='\0'){ |
85 | 85 | /* as the syslog is not prepared, error is send to web*/ |
86 | 86 | 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); | |
92 | 92 | PutMessageToClient(buff); |
93 | 93 | |
94 | 94 | return -1; |
@@ -98,10 +98,10 @@ int openConfFile(void) | ||
98 | 98 | if(isNull(ezxml_attr(xmlRoot, "ConfigVersion"))|| |
99 | 99 | (strcmp(CONFIG_VERSION, ezxml_attr(xmlRoot, "ConfigVersion"))!=0)){ |
100 | 100 | 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); | |
105 | 105 | PutMessageToClient(buff); |
106 | 106 | |
107 | 107 | return -1; |
@@ -113,8 +113,8 @@ int openConfFile(void) | ||
113 | 113 | |
114 | 114 | /* as the syslog is not prepared, error is send to web*/ |
115 | 115 | 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); | |
118 | 118 | PutMessageToClient(buff); |
119 | 119 | |
120 | 120 | return -1; |
@@ -46,8 +46,8 @@ int openClientGate(char *macAddress, char* userId, char* extraId) | ||
46 | 46 | /* prepare userid-long as [userid@extraid] */ |
47 | 47 | strlcpy(userIdLong, userId, WORDMAXLN); |
48 | 48 | if(!isNull(extraId)){ |
49 | - strncat(userIdLong, "@", WORDMAXLN); | |
50 | - strncat(userIdLong, extraId, WORDMAXLN); | |
49 | + strlcat(userIdLong, "@", WORDMAXLN); | |
50 | + strlcat(userIdLong, extraId, WORDMAXLN); | |
51 | 51 | } |
52 | 52 | |
53 | 53 | /* exclusive exec of ipfw to avoid overlapped rule number */ |
@@ -87,7 +87,7 @@ FILE *Popenl(int rootPriv, const char *type, const char *path, ...) | ||
87 | 87 | |
88 | 88 | while((pStr=va_arg(ap, char *))!=(char *)0){ |
89 | 89 | strcat(commandLine, " "); |
90 | - strncat(commandLine, pStr, BUFFMAXLN); | |
90 | + strlcat(commandLine, pStr, BUFFMAXLN); | |
91 | 91 | } |
92 | 92 | free(pStr); |
93 | 93 | va_end(ap); |
@@ -135,7 +135,7 @@ int Systeml(int rootPriv, const char *path, ...) | ||
135 | 135 | |
136 | 136 | while((pStr=va_arg(ap, char *))!=(char *)0){ |
137 | 137 | strcat(commandLine, " "); |
138 | - strncat(commandLine, pStr, BUFFMAXLN); | |
138 | + strlcat(commandLine, pStr, BUFFMAXLN); | |
139 | 139 | } |
140 | 140 | free(pStr); |
141 | 141 | va_end(ap); |
@@ -86,8 +86,8 @@ int authLdap(char *userid, char *passwd) | ||
86 | 86 | |
87 | 87 | /* set filter */ |
88 | 88 | strlcpy(filter, "(uid=", BUFFMAXLN); |
89 | - strncat(filter, userid, BUFFMAXLN); | |
90 | - strncat(filter, ")", BUFFMAXLN); | |
89 | + strlcat(filter, userid, BUFFMAXLN); | |
90 | + strlcat(filter, ")", BUFFMAXLN); | |
91 | 91 | |
92 | 92 | /* search LDAP entry */ |
93 | 93 | ret = ldap_search_ext_s(ld,baseDn,LDAP_SCOPE_SUBTREE, |
@@ -199,8 +199,8 @@ int isUserIdFoundInAcceptUsersList(char* userId){ | ||
199 | 199 | /* meaning is [(head or space) userid-string (space or tail)] */ |
200 | 200 | /* last-arg 0 of RegEx means ignore-case */ |
201 | 201 | strlcpy(userIdPattern, "(^| )", WORDMAXLN); |
202 | - strncat(userIdPattern, userId, WORDMAXLN); | |
203 | - strncat(userIdPattern, "( |$)", WORDMAXLN); | |
202 | + strlcat(userIdPattern, userId, WORDMAXLN); | |
203 | + strlcat(userIdPattern, "( |$)", WORDMAXLN); | |
204 | 204 | return RegExMatch(usersList, userIdPattern, 0); |
205 | 205 | } |
206 | 206 |
@@ -320,8 +320,8 @@ char* concatUserId(char* useridfull, char* userId, char* extraId){ | ||
320 | 320 | /* set full userid */ |
321 | 321 | strlcpy(useridfull, userId,USERMAXLN); |
322 | 322 | 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); | |
325 | 325 | } |
326 | 326 | return useridfull; |
327 | 327 | } |
@@ -572,8 +572,8 @@ int makeMailDefault(char* userId, char* extraId, char* mailDefault){ | ||
572 | 572 | /* if set mail domain, mail from userid+@+maildomain */ |
573 | 573 | if(!isNull(pMailDomain)){ |
574 | 574 | strlcpy(mailDefault, userId, BUFFMAXLN); |
575 | - strncat(mailDefault, "@", BUFFMAXLN); | |
576 | - strncat(mailDefault, pMailDomain, BUFFMAXLN); | |
575 | + strlcat(mailDefault, "@", BUFFMAXLN); | |
576 | + strlcat(mailDefault, pMailDomain, BUFFMAXLN); | |
577 | 577 | return TRUE; |
578 | 578 | }else{ |
579 | 579 | err_msg("ERR at %s#%d: Can't get mail domain string from conf file.",__FILE__,__LINE__); |
@@ -180,8 +180,8 @@ int getUserIdFromEnv(char *userid){ | ||
180 | 180 | /* if orp string can be get from env var, concatenate it as uid@org */ |
181 | 181 | pEnv=getenvEx(GetConfValue("AuthServer/OrgAttribute"),TRUE,TRUE); |
182 | 182 | 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); | |
185 | 185 | } |
186 | 186 | ret=TRUE; |
187 | 187 | } |
@@ -190,7 +190,7 @@ int getUserIdFromEnv(char *userid){ | ||
190 | 190 | else{ |
191 | 191 | pEnv=getenvEx(GetConfValue("AuthServer/EppnAttribute"),TRUE,FALSE); |
192 | 192 | if(!isNull(pEnv)){ |
193 | - strncat(userid, pEnv, USERMAXLN); | |
193 | + strlcat(userid, pEnv, USERMAXLN); | |
194 | 194 | ret=TRUE; |
195 | 195 | } |
196 | 196 | } |
@@ -840,10 +840,10 @@ int htmlReplace(char* buff,char *beforeStr,char *afterStr) | ||
840 | 840 | for(pBuff = tempBuff; |
841 | 841 | (pNext=StrSplit(pBuff, beforeStr)) != NULL; |
842 | 842 | pBuff = pNext){ |
843 | - strncat(buff,pBuff,BUFFMAXLN); | |
844 | - strncat(buff,afterStr,BUFFMAXLN); | |
843 | + strlcat(buff,pBuff,BUFFMAXLN); | |
844 | + strlcat(buff,afterStr,BUFFMAXLN); | |
845 | 845 | } |
846 | - strncat(buff,pBuff,BUFFMAXLN); | |
846 | + strlcat(buff,pBuff,BUFFMAXLN); | |
847 | 847 | |
848 | 848 | return 0; |
849 | 849 | } |
@@ -59,8 +59,8 @@ int openConfFile(void) | ||
59 | 59 | |
60 | 60 | /* as the syslog is not prepared, error is send to web*/ |
61 | 61 | 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); | |
64 | 64 | PutMessageToClient(buff); |
65 | 65 | |
66 | 66 | return -1; |
@@ -75,11 +75,11 @@ int openConfFile(void) | ||
75 | 75 | if(*errMsg!='\0'){ |
76 | 76 | /* as the syslog is not prepared, error is send to web*/ |
77 | 77 | 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); | |
83 | 83 | PutMessageToClient(buff); |
84 | 84 | |
85 | 85 | return -1; |
@@ -89,10 +89,10 @@ int openConfFile(void) | ||
89 | 89 | if(isNull(ezxml_attr(xmlRoot, "ConfigVersion"))|| |
90 | 90 | (strcmp(CONFIG_VERSION, ezxml_attr(xmlRoot, "ConfigVersion"))!=0)){ |
91 | 91 | 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); | |
96 | 96 | PutMessageToClient(buff); |
97 | 97 | |
98 | 98 | return -1; |
@@ -104,8 +104,8 @@ int openConfFile(void) | ||
104 | 104 | |
105 | 105 | /* as the syslog is not prepared, error is send to web*/ |
106 | 106 | 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); | |
109 | 109 | PutMessageToClient(buff); |
110 | 110 | |
111 | 111 | return -1; |
@@ -47,8 +47,8 @@ int openClientGate(char *clientAddr, int forced, char* userId, char* extraId, ch | ||
47 | 47 | /* prepare userid-long as [userid@extraid] */ |
48 | 48 | strlcpy(userIdLong, userId, WORDMAXLN); |
49 | 49 | if(!isNull(extraId)){ |
50 | - strncat(userIdLong, "@", WORDMAXLN); | |
51 | - strncat(userIdLong, extraId, WORDMAXLN); | |
50 | + strlcat(userIdLong, "@", WORDMAXLN); | |
51 | + strlcat(userIdLong, extraId, WORDMAXLN); | |
52 | 52 | } |
53 | 53 | |
54 | 54 | /* exclusive exec of ipfw to avoid overlapped rule number */ |
@@ -108,8 +108,8 @@ int sendMail(char* mailAddress, char* limitDate, char* device) | ||
108 | 108 | |
109 | 109 | /* prepare mail command [/bin/rmail user@domain] */ |
110 | 110 | strlcpy(mailCmd, mailCmdPath, BUFFMAXLN); |
111 | - strncat(mailCmd, " ", BUFFMAXLN); | |
112 | - strncat(mailCmd, mailAddress, BUFFMAXLN); | |
111 | + strlcat(mailCmd, " ", BUFFMAXLN); | |
112 | + strlcat(mailCmd, mailAddress, BUFFMAXLN); | |
113 | 113 | |
114 | 114 | /* prepare a pipe connected to the mail command */ |
115 | 115 | mailer = popen(mailCmd, "w"); |
@@ -216,7 +216,7 @@ FILE *Popenl(int rootPriv, const char *type, const char *path, ...) | ||
216 | 216 | |
217 | 217 | while((pStr=va_arg(ap, char *))!=(char *)0){ |
218 | 218 | strcat(commandLine, " "); |
219 | - strncat(commandLine, pStr, BUFFMAXLN); | |
219 | + strlcat(commandLine, pStr, BUFFMAXLN); | |
220 | 220 | } |
221 | 221 | free(pStr); |
222 | 222 | va_end(ap); |
@@ -264,7 +264,7 @@ int Systeml(int rootPriv, const char *path, ...) | ||
264 | 264 | |
265 | 265 | while((pStr=va_arg(ap, char *))!=(char *)0){ |
266 | 266 | strcat(commandLine, " "); |
267 | - strncat(commandLine, pStr, BUFFMAXLN); | |
267 | + strlcat(commandLine, pStr, BUFFMAXLN); | |
268 | 268 | } |
269 | 269 | free(pStr); |
270 | 270 | va_end(ap); |