Fossil SCM

Javascript-enabled hyperlinks now initially point to a honeypot, rather than to nothing.

drh 2013-08-12 12:50 trunk
Commit 2d14b6c4dc19ac774d0cae8722ee05e56e94f22d
1 file changed +12 -2
+12 -2
--- src/style.c
+++ src/style.c
@@ -112,11 +112,11 @@
112112
if( nHref>=nHrefAlloc ){
113113
nHrefAlloc = nHrefAlloc*2 + 10;
114114
aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
115115
}
116116
aHref[nHref++] = zUrl;
117
- return mprintf("<a %s id='a%d'>", zExtra, nHref);
117
+ return mprintf("<a %s id='a%d' href='%R/honeypot'>", zExtra, nHref);
118118
}
119119
char *href(const char *zFormat, ...){
120120
char *zUrl;
121121
va_list ap;
122122
va_start(ap, zFormat);
@@ -130,11 +130,11 @@
130130
if( nHref>=nHrefAlloc ){
131131
nHrefAlloc = nHrefAlloc*2 + 10;
132132
aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
133133
}
134134
aHref[nHref++] = zUrl;
135
- return mprintf("<a id='a%d'>", nHref);
135
+ return mprintf("<a id='a%d' href='%R/honeypot'>", nHref);
136136
}
137137
138138
/*
139139
** Generate <form method="post" action=ARG>. The ARG value is inserted
140140
** by javascript.
@@ -1193,5 +1193,15 @@
11931193
const char *zRedir = P("redirect");
11941194
if( zRedir ) cgi_redirect(zRedir);
11951195
}
11961196
style_footer();
11971197
}
1198
+
1199
+/*
1200
+** This page is a honeypot for spiders and bots.
1201
+**
1202
+** WEBPAGE: honeypot
1203
+*/
1204
+void honeypot_page(void){
1205
+ cgi_set_status(403, "Forbidden");
1206
+ @ <p>Access by spiders and robots is forbidden</p>
1207
+}
11981208
--- src/style.c
+++ src/style.c
@@ -112,11 +112,11 @@
112 if( nHref>=nHrefAlloc ){
113 nHrefAlloc = nHrefAlloc*2 + 10;
114 aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
115 }
116 aHref[nHref++] = zUrl;
117 return mprintf("<a %s id='a%d'>", zExtra, nHref);
118 }
119 char *href(const char *zFormat, ...){
120 char *zUrl;
121 va_list ap;
122 va_start(ap, zFormat);
@@ -130,11 +130,11 @@
130 if( nHref>=nHrefAlloc ){
131 nHrefAlloc = nHrefAlloc*2 + 10;
132 aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
133 }
134 aHref[nHref++] = zUrl;
135 return mprintf("<a id='a%d'>", nHref);
136 }
137
138 /*
139 ** Generate <form method="post" action=ARG>. The ARG value is inserted
140 ** by javascript.
@@ -1193,5 +1193,15 @@
1193 const char *zRedir = P("redirect");
1194 if( zRedir ) cgi_redirect(zRedir);
1195 }
1196 style_footer();
1197 }
 
 
 
 
 
 
 
 
 
 
1198
--- src/style.c
+++ src/style.c
@@ -112,11 +112,11 @@
112 if( nHref>=nHrefAlloc ){
113 nHrefAlloc = nHrefAlloc*2 + 10;
114 aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
115 }
116 aHref[nHref++] = zUrl;
117 return mprintf("<a %s id='a%d' href='%R/honeypot'>", zExtra, nHref);
118 }
119 char *href(const char *zFormat, ...){
120 char *zUrl;
121 va_list ap;
122 va_start(ap, zFormat);
@@ -130,11 +130,11 @@
130 if( nHref>=nHrefAlloc ){
131 nHrefAlloc = nHrefAlloc*2 + 10;
132 aHref = fossil_realloc(aHref, nHrefAlloc*sizeof(aHref[0]));
133 }
134 aHref[nHref++] = zUrl;
135 return mprintf("<a id='a%d' href='%R/honeypot'>", nHref);
136 }
137
138 /*
139 ** Generate <form method="post" action=ARG>. The ARG value is inserted
140 ** by javascript.
@@ -1193,5 +1193,15 @@
1193 const char *zRedir = P("redirect");
1194 if( zRedir ) cgi_redirect(zRedir);
1195 }
1196 style_footer();
1197 }
1198
1199 /*
1200 ** This page is a honeypot for spiders and bots.
1201 **
1202 ** WEBPAGE: honeypot
1203 */
1204 void honeypot_page(void){
1205 cgi_set_status(403, "Forbidden");
1206 @ <p>Access by spiders and robots is forbidden</p>
1207 }
1208

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button