Re: [unrev-II] patching xml based source

From: Jeff Miller (jeffm@dynamite.com.au)
Date: Wed Feb 16 2000 - 14:26:31 PST


From: Jeff Miller <jeffm@dynamite.com.au>

On Tue, Feb 15, 2000 at 03:27:42PM -0800, Eric Armstrong wrote:
> From: Eric Armstrong <eric.armstrong@eng.sun.com>
> Not sure I follow you.
> In my experience, "patches" applies to binary fixes. You modify
> the binary code with a "patch" that substitutes new opcodes for
> old ones.

on a unix host try "man patch" or "man diff"

for an example see the bottom of this post.
 
> Several problems remain to be worked out before that strategy
> is viable, however. Among them:
> * XML-links to external explanations won't be traversable
> by plain text users. So the XML links will have to be
> encoded as comments in the source file. Will that cause
> any technical problems or barriers to acceptance?

Depends on how verbose the comments are and how carefully they're placed.
With the xml version you'd be able to indicate the range of code that the
comment applies to exactly which would not be possible with plain text.
Also, comments in the middle of boolean expressions would not help the
understanding at all.

eg, if (a == /* fred says use meaningful names */b) {...}

> Did I stumble across an answer to your question, anywhere in there?

I think what I've heard referred to as patches you calling diffs. A
difference terminology can cause a lot of confusion. I've included the
example anyway just to be on the safe side.

Jeff.

example patch generated by diff

diff -Naur radiusd-cistron-1.5.4.3/src/Make.inc radiusd-cistron-1.5.4.3.cli/src/Make.inc
--- radiusd-cistron-1.5.4.3/src/Make.inc Sat Dec 19 18:52:48 1998
+++ radiusd-cistron-1.5.4.3.cli/src/Make.inc Sat Apr 17 03:58:41 1999
@@ -102,10 +102,10 @@
         rm -f ../build ../debian/substvars ../debian/files
 
 install:
- install -m 755 -s radiusd $(SBINDIR)/radiusd
- install -m 755 -s radwho $(BINDIR)
- install -m 755 -s raduse $(BINDIR)
- install -m 755 -s radzap $(BINDIR)
+ install -m 755 radiusd $(SBINDIR)/radiusd
+ install -m 755 radwho $(BINDIR)
+ install -m 755 raduse $(BINDIR)
+ install -m 755 radzap $(BINDIR)
         install -m 755 checkrad.pl $(SBINDIR)/checkrad
         install -m 755 radlast $(BINDIR)
 
diff -Naur radiusd-cistron-1.5.4.3/src/Makefile radiusd-cistron-1.5.4.3.cli/src/Makefile
--- radiusd-cistron-1.5.4.3/src/Makefile Tue Nov 17 11:08:47 1998
+++ radiusd-cistron-1.5.4.3.cli/src/Makefile Sat Apr 17 03:56:08 1999
@@ -22,10 +22,11 @@
 DBMLIB = -ldb
 
 # Uncomment these if you want PAM support
-#PAM = -DPAM
-#PAMLIB = -lpam -ldl
+PAM = -DPAM
+PAMLIB = -lpam -ldl
 
 BINDIR = /usr/local/bin
 SBINDIR = /usr/local/sbin
 
 include Make.inc
+
diff -Naur radiusd-cistron-1.5.4.3/src/auth.c radiusd-cistron-1.5.4.3.cli/src/auth.c
--- radiusd-cistron-1.5.4.3/src/auth.c Sat Jan 9 19:17:14 1999
+++ radiusd-cistron-1.5.4.3.cli/src/auth.c Tue Apr 27 23:23:12 1999
@@ -509,6 +509,7 @@
         VALUE_PAIR *user_check;
         VALUE_PAIR *user_reply;
         VALUE_PAIR *proxy_pairs;
+ VALUE_PAIR *phone_item;
         int result, r;
         char pw_digest[16];
         char userpass[128];
@@ -529,6 +530,11 @@
         namepair = pairfind(authreq->request, PW_USER_NAME);
 
         /*
+ * Extract calling number for logging.
+ */
+ phone_item = pairfind(authreq->request, PW_CALLING_STATION_ID);
+
+ /*
          * FIXME: we calculate the digest twice ...
          * once here and once in rad_auth_init()
          */
@@ -572,8 +578,10 @@
          */
         if (user_find(namepair->strvalue, authreq->request,
            &user_check, &user_reply) != 0) {
- log(L_AUTH, "Invalid user: [%s] (from nas %s)",
- namepair->strvalue, nas_name2(authreq));
+ log(L_AUTH, "Invalid user: [%s] ph: [%s] (from nas %s)",
+ namepair->strvalue,
+ (phone_item == NULL) ? "" : phone_item->strvalue,
+ nas_name2(authreq));
                 rad_send_reply(PW_AUTHENTICATION_REJECT, authreq,
                         proxy_pairs, NULL, activefd);
                 pairfree(proxy_pairs);
@@ -619,8 +627,10 @@
                         user_reply, user_msg, activefd);
                 if (log_auth) {
                         log(L_AUTH,
- "Login incorrect: [%s/%s] (from nas %s)",
- namepair->strvalue, userpass,
+ "Login incorrect: [%s/%s] ph: [%s] (from nas %s)",
+ namepair->strvalue,
+ userpass,
+ (phone_item == NULL) ? "" : phone_item->strvalue,
                                 nas_name2(authreq));
                 }
         }
@@ -649,8 +659,9 @@
                         }
                         rad_send_reply(PW_AUTHENTICATION_REJECT, authreq,
                                 user_reply, user_msg, activefd);
- log(L_ERR, "Multiple logins: [%s] (from nas %s) max. %d%s",
+ log(L_ERR, "Multiple logins: [%s] ph: [%s] (from nas %s) max. %d%s",
                                 namepair->strvalue,
+ (phone_item == NULL) ? "" : phone_item->strvalue,
                                 nas_name2(authreq),
                                 check_item->lvalue,
                                 r == 2 ? " [MPP attempt]" : "");
@@ -725,8 +736,10 @@
                                 user_reply, user_msg, activefd);
                         if (log_auth) {
                                 log(L_AUTH,
- "Login incorrect: [%s] (from nas %s) (external check failed)",
- namepair->strvalue, nas_name2(authreq));
+ "Login incorrect: [%s] ph: [%s] (from nas %s) (external check failed)",
+ namepair->strvalue,
+ (phone_item == NULL) ? "" : phone_item->strvalue,
+ nas_name2(authreq));
                         }
                         authfree(authreq);
                         pairfree(user_check);
@@ -774,15 +787,16 @@
         rad_send_reply(PW_AUTHENTICATION_ACK, authreq,
                         user_reply, user_msg, activefd);
         if (log_auth) {
-#if 1 /* Hide the password for `miquels' :) */
+#if 0 /* Hide the password for `miquels' :) */
                 if (strcmp(namepair->strvalue, "miquels") == 0)
                         strcpy(userpass, "guess");
 #endif
                 log(L_AUTH,
- "Login OK: [%s%s%s] (from nas %s)",
+ "Login OK: [%s%s%s] ph: [%s] (from nas %s)",
                         namepair->strvalue,
                         log_auth_pass ? "/" : "",
                         log_auth_pass ? userpass : "",
+ (phone_item == NULL) ? "" : phone_item->strvalue,
                         nas_name2(authreq));
         }
         if (exec_program && !exec_wait) {
diff -Naur radiusd-cistron-1.5.4.3/src/radius.h radiusd-cistron-1.5.4.3.cli/src/radius.h
--- radiusd-cistron-1.5.4.3/src/radius.h Sat Dec 19 15:40:55 1998
+++ radiusd-cistron-1.5.4.3.cli/src/radius.h Fri Apr 16 10:06:23 1999
@@ -96,6 +96,7 @@
 #define PW_VENDOR_SPECIFIC 26
 #define PW_SESSION_TIMEOUT 27
 #define PW_IDLE_TIMEOUT 28
+#define PW_CALLING_STATION_ID 31
 #define PW_PROXY_STATE 33
 
 #define PW_ACCT_STATUS_TYPE 40

--------------------------- ONElist Sponsor ----------------------------

GET A NEXTCARD VISA, in 30 seconds. Get rates as low as 0.0 percent
Intro or 9.9 percent Fixed APR and no hidden fees. Apply NOW.
<a href=" http://clickme.onelist.com/ad/NextcardCreative5CI ">Click Here</a>

------------------------------------------------------------------------

Community email addresses:
  Post message: unrev-II@onelist.com
  Subscribe: unrev-II-subscribe@onelist.com
  Unsubscribe: unrev-II-unsubscribe@onelist.com
  List owner: unrev-II-owner@onelist.com

Shortcut URL to this page:
  http://www.onelist.com/community/unrev-II



This archive was generated by hypermail 2.0.0 : Tue Aug 21 2001 - 18:56:48 PDT