Created
March 13, 2014 15:45
-
-
Save fabienengels/9530932 to your computer and use it in GitHub Desktop.
SSL renegociation bug with Golang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"database/sql" | |
"flag" | |
_ "github.com/lib/pq" | |
"log" | |
) | |
func main() { | |
seiscompParameters := flag.String("postgres", "postgres://test:test@127.0.0.1:5432/test?sslmode=require", "Database connection parameters") | |
flag.Parse() | |
db, err := sql.Open("postgres", *seiscompParameters) | |
if err != nil { | |
log.Fatal(err) | |
} | |
defer db.Close() | |
count := 0 | |
for { | |
count = 0 | |
rows, err := db.Query("SELECT md5 FROM data;") | |
if err != nil { | |
log.Fatal(err) | |
} | |
for rows.Next() { | |
count++ | |
} | |
log.Println(count, " rows") | |
if count != 10000 { | |
log.Fatal("Wrong result after SSL renegociation") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment