1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
<pre>
<font color="#0000ff">// Copyright (c) 2003 David Muse</font>
<font color="#0000ff">// See the file COPYING for more information</font>
<font color="#a020f0">#include </font><font color="#ff00ff"><rudiments/shadowentry.h></font>
<font color="#a020f0">#include </font><font color="#ff00ff"><stdio.h></font>
<font color="#a020f0">#ifdef RUDIMENTS_NAMESPACE</font>
<font color="#a52a2a"><b>using</b></font> <font color="#2e8b57"><b>namespace</b></font> rudiments;
<font color="#a020f0">#endif</font>
<font color="#2e8b57"><b>int</b></font> main(<font color="#2e8b57"><b>int</b></font> argc, <font color="#2e8b57"><b>const</b></font> <font color="#2e8b57"><b>char</b></font> **argv) {
<font color="#0000ff">// get the shadow entry for "root"</font>
shadowentry spent;
spent.initialize(<font color="#ff00ff">"root"</font>);
<font color="#0000ff">// print the components individually</font>
printf(<font color="#ff00ff">"Individually...</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>);
printf(<font color="#ff00ff">" Name: </font><font color="#6a5acd">%s</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>,spent.getName());
printf(<font color="#ff00ff">" Encrypted Password: </font><font color="#6a5acd">%s</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>,spent.getEncryptedPassword());
printf(<font color="#ff00ff">" Last Change: </font><font color="#6a5acd">%ld</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>,
spent.getLastChangeDate());
printf(<font color="#ff00ff">" Days Before Change Allowed: </font><font color="#6a5acd">%d</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>,
spent.getDaysBeforeChangeAllowed());
printf(<font color="#ff00ff">" Days Before Change Required: </font><font color="#6a5acd">%d</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>,
spent.getDaysBeforeChangeRequired());
printf(<font color="#ff00ff">" Days Before Expiration Warning: </font><font color="#6a5acd">%d</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>,
spent.getDaysBeforeExpirationWarning());
printf(<font color="#ff00ff">" Days Of Inactivity Allowed: </font><font color="#6a5acd">%d</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>,
spent.getDaysOfInactivityAllowed());
printf(<font color="#ff00ff">" Expiration Date: </font><font color="#6a5acd">%d</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>,
spent.getExpirationDate());
printf(<font color="#ff00ff">" Flag: </font><font color="#6a5acd">%d</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>,spent.getFlag());
printf(<font color="#ff00ff">"</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>);
<font color="#0000ff">// use the built in print method</font>
printf(<font color="#ff00ff">"Built In...</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>);
spent.print();
printf(<font color="#ff00ff">"</font><font color="#6a5acd">\n</font><font color="#ff00ff">"</font>);
}
</pre>
|